import {Component} from 'react';
import {
    Group,
    Toast,
    Button,
    Dialog,
    RadioField,
    TextareaField,
    CheckboxField,
    TextField,
    Tab,Boxs,ActionSheet,Slot,Popup
} from 'saltui';

const { VBox,HBox,Box } = Boxs;
//import UserInfo from '../approval-details/UserInfo';
import DB from 'db';
import {URLS} from 'variables';
import Table from 'components/form';
import FlowChart from './FlowChart';
import RelationProcess from './RelationProcess';
import SelectMember from 'components/selectMember';
import { msgNoData } from '../../../app/variables';
const {
	Count
} = TextareaField;

let ActionSheetButton;
let iconIndex = 0;

let FlowCommon ;
let regxp={
		"*":/[\w\W]+/,
		"*6-16":/^[\w\W]{6,16}$/,
		"n":/^\d+$/,
		"n6-16":/^\d{6,16}$/,
		"n0-6":/^\d{0,6}$/,
		"s":/^[\u4E00-\u9FA5\uf900-\ufa2d\w\.\s]+$/,
		"s6-18":/^[\u4E00-\u9FA5\uf900-\ufa2d\w\.\s]{6,18}$/,
		"p":/^[0-9]{6}$/,
		"m":/^1[345678][0-9]{9}$/,
		"e":/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
		"url":/^(\w+:\/\/)?\w+(\.\w+)+.*$/,
		'card':/^(\d{6})(19|20)(\d{2})(1[0-2]|0[1-9])(0[1-9]|[1-2][0-9]|3[0-1])(\d{3})(\d|X|x)$/,
		'password':/^[^\u4e00-\u9fa5\s]{1,}$/,
		'r5':/^([\u4E00-\u9FA5]|\w|\.|\~|\@|\（|\）|\(|\)|\-|\+|\=|\{|\}|\【|\】|\[|\]|\。|\、|\《|\》|\；|\;|\？|\?)+$/,
		'r4':/^[\da-zA-Z_]+$/,
		'r3':/^[a-zA-Z][a-zA-Z0-9_]*$/,
		'r2':/^(\w|\.)+$/,
		'r1':/^([\u4E00-\u9FA5]|\w|\.)+$/,
		'noempty':/^[^ ]+$/
	};
class PageHome extends Component {
    constructor(props){
        super(props);
        $(".loading-containter").hide();
        // dd.biz.navigation.setTitle({
        //     title: props.info.cnName + '的报修申请',
        //     onSuccess: function(result){
        //     },
        //     onFail: function(){
        //     }
        // });
        // let userId = this.props.params.startUserId;
        // if(!userId){
        //     userId = document.getElementById('userHiddenId').value;
        // }
        
        let userId = document.getElementById('userHiddenId').value;
        var listType =this.props.params.listType;
        let permissionCode='other';
        let status = '0';
        let dataId = this.props.params.dataId;
        let editType = '';
        if( dataId && dataId !='-1'){//非新增
        	setPageTitle("流程详情");
            if(listType == '0' || listType == '5'){ //待办|草稿箱
                status = '1';
                editType = 'edit';
            }else{
                status = '2';
                editType = 'view';
            }
            
            if(listType == '0'){
            	permissionCode='pending';
            }else if(listType == '1'){
            	permissionCode='unRead';
            }else if(listType == '2'){
            	permissionCode='done';
            }else if(listType == '3'){
            	permissionCode='read';
            }else if(listType == '4'){
            	permissionCode='my';
            }else if(listType == '99'){
            	permissionCode='other';
            }
            
		}else{
            dataId = "";
            editType = 'add';
            permissionCode='start';
            setPageTitle("新建");
        }
		let isPush = this.props.params.isPush;
        let isDraft = this.props.location.query.isDraft;//是不是草稿箱,1是，0：不是
        if(isDraft){
        	permissionCode='draft';
        }else{
            isDraft = "0";
        }
        if(isPush!='0'){
        	permissionCode='other';
        }
        let project = this.props.location.query.project;//项目，是首页，公文，还是
        if(project){

        }else{
            project = "";
        }
        let backTypeList=[
            {
            value:"1",
            checked:false,
            content:'允许提交至退回活动',
            disable:false
            }
        ];
        let urgentList=[
            {
            value:"1",
            checked:false,
            content:'紧急',
            disable:false
            }
        ];
        
        let shortMessageList=[
            {
            value:"1",
            checked:false,
            content:'短信提醒',
            disable:false
            }
        ];
        let readShortMessageList=[
            {
        	  value:"1",
        	  checked:false,
        	  content:'短信提醒',
        	  disable:false
             }
         ];
        //是否保存为常用语
        let savePhraseList=[
            {
            value:"1",
            checked:false,
            content:'是否保存为常用语',
            disable:false
            }
        ];
        
        const keyNum = this.GenNonDuplicateID(8);

        let category = this.props.params.category;//模块
        let module = this.props.params.module;//分类
        if(!module){
            module = "approve";
        }
        var finalButtons=new Map(); 
        DB.FlowModuleAPI.getListButtonsByCodes({
     		 buttonCodes: ''
        }).then((content) => {
            for(var i=0;i<content.length;i++){
                if(content[i].buttonCode!="MEETING_MODEL"){
                    finalButtons.set(content[i].buttonCode,content[i].buttonName);
                }
			}
            finalButtons.set('BASE_SUMBIT','通过');
            finalButtons.set('PAGE_SAVE','保存');
        }).catch((error) => {
            console.error(error);
        });
        var thirdMenuType = getLoginUserInfo().thirdMenuType;
        var param = {
            title:this.props.params.title,//流程标题
            flowIsDeleted:false,
            thirdMenuType:thirdMenuType,
            editType:editType,
            isDraft:isDraft,
            listType:listType,
            permissionCode:permissionCode,
            isPush: isPush,
            project:project,
            module:module,
			category:category,
            processInstanceId:this.props.params.processInstanceId,
            taskId:this.props.params.taskId,
            userId: userId,
            formItem:[],
            formTblName:'',
            dataId:dataId,
            formId:this.props.params.formId,
			editFormData:{},
			formDataNew:{},
            data:{
              dataId:"",
              formId:"",
              userId: userId,
              mainTblName: "",
              mainTblData:[],
              subTbl:[],
              relatedTbl:[],
              trans:false,
            },
            status:status,
            transferPersonValue:[],//转交选择的用户
            claimType:true,
            nextActivityList:[],//下一个活动节点列表
            nextRadomList:[],//下一个活动节点随机
            nextSelectType:"",//下一个活动选择类型
            canBackActivity:[],//可以驳回的活动节点
            selectBackActivity:{},//选择的活动节点
            pageStatus:'0',//状态，0代表开始页面，1代表提交选择到下一个活动节点
            commentDefaultList:[],//默认审批意见
            commentFieldList:[],//字段审批意见
            hasCommentField:'0',//是否有审批意见
            commentIsNull:'0',//审批意见是否可为空，0是，1否
            commentIsNotNull:'0',//审批意见是否可为空，0是，1否
            buttons:'',//按钮
            startButtons:'',//起始节点按钮
            operate:0,//操作码
            spyj:'',//审批意见
            canBackType:'',//可以驳回的类型
            backType:'',//驳回的类型
            backTypeList:backTypeList,//可驳回选项
            backTypeSelectList:[],//已选择的驳回选项
            activeItemIndex:'0',
			fieldControll:{},//字段控制
			code:'',//流程编码
			processIsComplete:'2', //流程的状态是否结束,0,未结束，1：已结束
            handleUserDingId: [],//办理人
            readtype:"2",//1待阅，2已阅
            loadSuccess:false,//是否加载完成
            participantMode:'-1',//节点类型，0：单人，1：会签，2：串签,3:抢占
            selectJumpActivity:{},//选择的跳转节点
            nextJumpActivity:[],//下一个跳转节点
            jumpPersonValue:[],//转交选择的用户
            addlotsPersonValue:[],//加签选择的用户
            circulateNodePersonValue:[],//传阅节点选择的用户
            circulatePersonValue:[],//通过传阅的用户
            buttonList:[],//待办按钮列表
            actionSheetButtonOpt:[],//动作面板选项属性
            buttonIsMore:false,//是否有更多按钮
            urgentSelectList:[],//已选择的紧急选项
            urgentList:urgentList,//紧急选项
            urgentHidden:false,//紧急是否显示
            processLogList:[],//办理记录
            doingUserList:[],//在办用户
            lock:'',//流程锁
            isStart:false,
            processStatus:'0',
            keyNum:keyNum,
            urgent:'0',//紧急状态，0：不紧急
            tasktype:'',//流程节点类型,随机流程radom
            level:'',//随机流程第几等级
            levelCount:'',//随机流程等级总数
            activityId:'',//活动节点
            phraseList:[],//常用语列表
            choosePhrase:[],//常用语列表选择
            savePhraseList:savePhraseList,//是否保存为常用语的选项列表
            savePhrase:[],//是否保存为常用语，1是，0否
            isEnd:false,//判断是不是最后一个节点了，下一步就是直接结束
            isHideRead:false,//是否隐藏传阅
            urgeDataList:[],//催办列表
            selectUrgeActivity:[],//催办用户
            urgeContent:'',//催办内容
            reminders:[],
            remindersList:[],//提醒方式
            errorMsg:'',
            buttonCodeList:'',
            tableStatus:'0',
            finalButtons:finalButtons,
            backReasonText:'',//驳回原因
            recoverReasonText:'',//收回原因
            shortMessageList:shortMessageList,
            readShortMessageList:readShortMessageList,
            sendShortMessage:'0',
            transferShortMessage:'0',
            jumpShortMessage:'0',
            backShortMessage:'0',
            circulateShortMessage:'0',
            addlotsShortMessage:'0',
            sysSMSsetting:'0'
          };
        FlowCommon = require('pages/flow_common/'+module);
        //处理特有参数
        if(typeof FlowCommon.dealwithCommonParam === "function"){
            param = FlowCommon.dealwithCommonParam(param,this.props);
        } 
        this.state = param;
        let t = this;
        var key = "";
        if(project=='mobileportal'){//如果项目是首页
            key = 'mobileportal_helpNew_'+userId; 
        }else{
            key = module+'_helpNew_'+userId; 
        }

        dd.util.domainStorage.getItem({ //点击帮助页面
        name:key , // 存储信息的key值
        onSuccess : function(info) {
            let helpNew = info.value;
            if( typeof(helpNew) != 'undefined' && helpNew != '' ){
            iconIndex = 1;
            }
            t.initButton(iconIndex);
        },
        onFail : function(err) {
        }
        });
		   
        //this.addBackListener();
    }

	GenNonDuplicateID(randomLength){
		return Number(Math.random().toString().substr(3,randomLength) + Date.now()).toString(36)
	   }
    
    //左侧返回监听
    addBackListener(){
        var client = isIos();
        if(client == 'ios'){ //ios
            // dd.biz.navigation.setLeft({
            //     control: true,//是否控制点击事件，true 控制，false 不控制， 默认false
            //     text: '',//控制显示文本，空字符串表示显示默认文本
            //     onSuccess : function(result) {
            //         Dialog.hide();
            //         Popup.hide();
            //         $("#App").css({
            //         "overflow":"auto",
            //         "height":"",
            //         });
            //         if(ActionSheetButton){
            //             ActionSheetButton.close();
            //         }
            //         dd.biz.navigation.setLeft({
            //             control: false,//是否控制点击事件，true 控制，false 不控制， 默认false
            //             text: '',//控制显示文本，空字符串表示显示默认文本
            //             onSuccess : function(result) {
            //                 //如果control为true，则onSuccess将在发生按钮点击事件被回调
            //             },
            //             onFail : function(err) {}
            //         });
            //         backPage();
            //         //如果control为true，则onSuccess将在发生按钮点击事件被回调
            //     },
            //     onFail : function(err) {}
            // });
        }else if(client == 'android'){
            // document.addEventListener('backbutton', function(e) {
            //     $("#App").css({
            //         "overflow":"auto",
            //         "height":"",
            //         });
            //     Dialog.hide();
            //     Popup.hide();
            //     if(ActionSheetButton){
            //         ActionSheetButton.close();
            //     }
            //     e.preventDefault(); //backbutton事件的默认行为是回退历史记录，如果你想阻止默认的回退行为，那么可以通过preventDefault()实现
            // });
        }
    }
	
	//初始化按钮
	initButton(iconIndex){
        let t = this;
	    //设置帮助
	    dd.biz.navigation.setRight({
	        show: true,//控制按钮显示， true 显示， false 隐藏， 默认true
	        onSuccess : function(result) {
	        },
	        onFail : function(err) {}
	    });
    }

    componentWillUnmount(){
        //Popup.hide();
        //手机返回的时候关闭一些弹出框和调整一些样式
        $("#App").css({
            "overflow":"auto",
            "height":"",
            });
        Dialog.hide();
        Popup.hide();
        if(ActionSheetButton){
            ActionSheetButton.close();
        }
    }

    componentDidMount() {
    let t= this;
    var taskId = this.state.taskId;
    var processInstanceId = this.state.processInstanceId;
    var listType = this.state.listType;

    var dealwithId = '';
	// if (listType == 0||listType == 1||listType == 3) { //待办，待阅，已阅
	// 	//handleUserId = "";
	// 	dealwithId =t.state.taskId; 
	// }else{
	// 	dealwithId =t.state.processInstanceId; 
	// }
    var param = {
		formId: t.state.formId,
		dataId: t.state.dataId,
		permissionCode: t.state.permissionCode,
        taskId: taskId,
        processInstanceId: processInstanceId,
		type: listType,
		//startUserId:startUserId,
		module:this.state.module
    };
    
    if(listType =='0'){
        if( taskId != null && taskId != undefined){
            DB.FlowModuleAPI.claimTask({taskId:taskId,processInstanceId:processInstanceId}).then((content) => {
                if(t.state.permissionCode=='other'){
                	if(content.success){
                		t.setState({
                			permissionCode:'pending'
                        });
                	}else{
                		t.setState({
                			permissionCode:'done'
                        });
                	}
                }
                
                if(content!=null && content!=''){
                	t.setState({
                		sysSMSsetting:content.sysSMSsetting
                    });
    				if(content['showType']=='1' && content['operationDetails']!=null){
    					t.setState({
    						operationDetails:content.operationDetails
                        });
    				}
    				/*else if(content['showType']=='2' && content['operationDetails']!=null){
    					
    					Dialog.alert({
    					      title: '收回原因',
    					      content: content['operationDetails']
    					      
    					    });
    				}*/
    			}
                
                t.loadPage(param);
            }).catch((error) => {
                t.loadPage(param,"0");//没有待办权限
            });
        }else{
            t.loadPage(param);
        }
    }else{
        t.loadPage(param)
    }
	
    }

    //加载页面
    loadPage(param,canDeal){
        let t = this;
        if(canDeal == '0'){
            param.type='2';
            this.setState({
                listType:'5',
                status:'2'
            });
        }
       
         //查询流程详情
        if(typeof FlowCommon.dealwithCommonFolowInfo === "function"){
            param = FlowCommon.dealwithCommonFolowInfo(param,t.state,function(content){
            if(t.state.listType=='4'){
            	var details=content['details'];
            	if(details!=null && details['showType']=='1' && details['operationDetails']!=null){
					Dialog.alert({
					      title: '退回原因',
					      content: details['operationDetails']
					      
					    });
				}
            	t.setState({
            		taskId:content.taskId
            	});
            }
            
            if(t.state.listType=='0'){
            	var tipsTitle=content['tipsTitle'];
            	if(t.state.operationDetails!=null && t.state.operationDetails!=''){
            		Dialog.alert({
					      title: '退回原因',
					      content: t.state.operationDetails,
					      onConfirm() {
					    	  if(tipsTitle!=null && tipsTitle!='' && tipsTitle!='undefined'){
				            		var tipsContent=content['tipsContent'];
				            		if(tipsContent.length>300){
				            			tipsContent=tipsContent.substring(0,300)+"...";
				            		}
									Dialog.alert({
									      title: tipsTitle,
									      content: tipsContent
									    });
								}
					        }
					    });
            	}else{
            		if(tipsTitle!=null && tipsTitle!='' && tipsTitle!='undefined'){
                		var tipsContent=content['tipsContent'];
                		if(tipsContent.length>300){
                			tipsContent=tipsContent.substring(0,300)+"...";
                		}
    					Dialog.alert({
    					      title: tipsTitle,
    					      content: tipsContent
    					    });
    				}
            	}
            	
            }
            
            let form = content.form;
			let formItem = form.item;

			if(typeof(formItem) == 'undefined'){
				formItem = [];
			}
			let hasCommentField = content.hasCommentField;
			if(!hasCommentField){
				hasCommentField='0';
            }
            
            let commentIsNull = content.commentIsNull;
			if(!commentIsNull){
				commentIsNull='0';
            }
            
			let commentIsNotNull = content.commentIsNotNull;
			if(!commentIsNotNull){
				commentIsNotNull='0';
			}
			
			let buttons = content.buttons;//按钮
			if(!buttons){
				buttons = "";
            }

            //起始节点按钮
            let startButtons = content.startButtons;//按钮
			if(!startButtons){
				startButtons = "";
            }
            
			let processIsComplete = content.processIsComplete;
			let handleUserDingId = content.handleUserDingId;
            
            //流程标题
            let fileTitle = content.title;
            if(!fileTitle){
                fileTitle = "";
            }
			// for (let j = 0; j < len; j++) {
			// 	if (mainTblData[j].key == 'file_title') {
			// 		fileTitle = mainTblData[j].value;
			// 		if(!fileTitle){
			// 			fileTitle = "";
			// 		}
			// 		break;
			// 	}
			// }
            let formData = content.formData;
            if(formData){
                formData.trans = false;
                if(formData.dataId!='' && formData.dataId!=null){
                	 for(var a=0;a<formItem.length;a++){
                     	if(formItem[a].inputFormat=='float' || formItem[a].inputFormat=='int'){
                     		var itemCode=formItem[a].itemCode;
                     		var mainTblData1=formData.mainTblData;
                     		if(mainTblData1!=null && mainTblData1.length>0){
                     			for(var b=0;b<mainTblData1.length;b++){
                     				if(mainTblData1[b].key==itemCode){
                     					if(formItem[a].inputFormat=='float' && formData.mainTblData[b].value!=null && formData.mainTblData[b].value!=''){
                     						formData.mainTblData[b].value=parseFloat(formData.mainTblData[b].value).toFixed(formItem[a].decimalPlace);
                     					}
                     					if(mainTblData1[b].value===0){
                     						formData.mainTblData[b].value="0";
                     					}
                     				}
                     			}
                     		}
                     	}else if(formItem[a]['children'] && formItem[a]['children'].length>0){
                     		var children=formItem[a]['children'];
                     		var subTblName=formItem[a].itemCode;
                     		for(var d=0;d<children.length;d++){
                     			var formItems=children[d];
                     			if(formItems.inputFormat=='float' || formItems.inputFormat=='int'){
                             		var itemCode=formItems.itemCode;
                             		var uniqueName=formItems.uniqueName;
                             		var subTbl=formData.subTbl;
                             		if(subTbl!=null && subTbl.length>0){
                             			for(var b=0;b<subTbl.length;b++){
                             				if(subTbl[b].subTblName==subTblName){
                             					var subTblData=subTbl[b].subTblData;
                             					if(subTblData!=null && subTblData.length>0){
                             						for(var f=0;f<subTblData.length;f++){
                             							var subTblDatas=subTblData[f];
                             							if(subTblDatas!=null && subTblDatas.length>0){
                             								for(var g=0;g<subTblDatas.length;g++){
                             									if(subTblDatas[g].key==itemCode){
                             										if(formItems.inputFormat=='float' && formData.subTbl[b].subTblData[f][g].value!=null && formData.subTbl[b].subTblData[f][g].value!=''){
                             											formData.subTbl[b].subTblData[f][g].value=parseFloat(formData.subTbl[b].subTblData[f][g].value).toFixed(formItems.decimalPlace);
                                                 					}
                                     								if(subTblDatas[g].value===0){
                                     									formData.subTbl[b].subTblData[f][g].value="0";
                                     								}
                                     							}
                             								}
                             							}
                             							
                             						}
                             					}
                             				}
                             			}
                             		}
                             	}
                     		}
                     		
                     	}
                     }
                }
               
            }else{
                formData = {};
                formData.mainTblData=[];
                formData.subTbl=[];
                formData.relatedTbl=[],
                formData.trans=false;
                formData.mainTblName = form.formTblName;
                formData.formId = form.formId;
            }
            formData.linkFields=form.linkFields;
            formData.formItem=formItem;
			var commentFieldList = [];
			var commentDefaultList = [];
			var commentList = content.commentList
			for(let i=0; i<commentList.length; i++){
                var commentItem = commentList[i];
                if(commentItem.type=='text4'&&commentItem.fullMessage.trim()==''){//当批示意见类型是无，且批示意见内容为空时过滤掉
                    continue;
                }
                if(commentItem.field != 'default'){//默认意见
                    commentFieldList.push(commentItem);
                }else{
                    commentDefaultList.push(commentItem);
                }
            }
            let readtype = content.readtype;
            if(!readtype){
                readtype = "2";
            }

            //已办记录
            let processLogList =  content.processLogList;
            if(typeof(processLogList) == 'undefined'){
                processLogList = [];
            }
    
            //在办用户列表
            let doingUserList =  content.doingUserList;
            if(typeof(doingUserList) == 'undefined'){
                doingUserList = [];
            }

            let selectOptions=[];
            if(doingUserList!=null && doingUserList!='' && doingUserList.length>0){
				for(var du=0;du<doingUserList.length;du++){
					if((","+doingUserList[du]['buttons']).indexOf(',PAGE_URGE')!=-1){
						var userIds=doingUserList[du].userId;
						var userNames=doingUserList[du].userName;
						var uid=userIds.split(',');
						var uname=userNames.split(',');
						for(var ui=0;ui<uid.length;ui++){
							var option = {};
				            option.value = doingUserList[du].taskId+';'+uid[ui];
				            option.content = uname[ui];
				            option.disable = false;
				            option.checked = false;
				            option.name =  uname[ui];
				            selectOptions.push(option);
						}
					}
				}
			}
            //紧急
            let urgency = content.urgency;
            if(!urgency){
                urgency = '0';
            }

            //随机流程
            let tasktype = content.tasktype;
            let level = '';
            let levelCount = '';
            if(tasktype){
                level = content.level;
                levelCount = content.levelCount;
            }else{
                tasktype = '';
            }

            let activityId = content.activityId;
            if(activityId){

            }else{
                activityId = "";
            }
            
            let sysSMSsetting=content.sysSMSsetting;
            let sysImType=content.sysImType;
            let sysMailSetting=content.sysMailSetting;
            var remindersLists=[];
            if(sysMailSetting=='1' || sysMailSetting=='2'){
            	var option = {};
            	option.value = "0";
            	option.content = '邮件';
            	option.disable = false;
            	option.checked = false;
            	remindersLists.push(option);
            }
            if(sysSMSsetting=='1'){
            	var option = {};
	            option.value = "1";
	            option.content = '短信';
	            option.disable = false;
	            option.checked = false;
	            remindersLists.push(option);
            }
            if(sysImType!=''){
            	var option = {};
	            option.value = "2";
	            option.content = '移动端';
	            option.disable = false;
	            option.checked = false;
	            remindersLists.push(option);
            }
           
             
            // let urgentList = t.state.urgentList;
            // let urgentSelectList = [];
            // if(urgency){
            //     if(urgency == '1'){
            //         urgentList[0].checked = true;
            //         urgentSelectList = urgentList;
            //     }
            // }
			t.setState({
                editFormData: formData,
				//formDataNew:content.formDataNew,
				// formData: formData,
				// fileContent: fileContent,
				// fileAttachment: fileAttachment,
				processIsComplete: processIsComplete,
				handleUserDingId: handleUserDingId,
				 commentDefaultList:commentDefaultList,
				 commentFieldList:commentFieldList,
                 buttons:buttons,
                 startButtons:startButtons,
				 code:content.code,
				 formItem:formItem,
				 form:form,
                 hasCommentField:hasCommentField,
                 commentIsNull:commentIsNull,
                 commentIsNotNull:commentIsNotNull,
				 fileTitle:fileTitle,
                 fieldControll:content.fieldControll,
                 readtype:readtype,
                 loadSuccess:true,
                 participantMode:content.participantMode,
                 processLogList:processLogList,//已办记录
                 doingUserList:doingUserList,//在办用户列表
                 lock:content.lock,//流程锁
                 isStart:content.isStart,
                 processStatus:content.processStatus,
                //  urgentSelectList:urgentSelectList,
                //  urgentList:urgentList
                urgent:urgency,
                tasktype:tasktype,//流程节点类型
                level:level,
                levelCount:levelCount,
                activityId:activityId,//活动节点
                urgeDataList:selectOptions,
                remindersList:remindersLists,
                errorMsg:"no",
                tableStatus:'1',
                sysWatermark:content.sysWatermark,
                permissionCode:content.permissionCode,
                isStart:content.isStart
            });
            t.dealWithButtons(content);

            },function(error){
                setTimeout(
                    function () {
                        Toast.show({
                        	
                            type: 'error',
                            content: error,
                        });
                        setTimeout(
                            function () {
                            		if(error=='任务不存在'){
                            			t.setState({
                            				errorMsg:error
                            	        });
                            		}else{
                            		backPage();
                            	}
                            }, 1500);
                    }, 800);
            });
        } 
    }

    //处理button
    dealWithButtons(content){
        let t = this;
        //处理特有按钮事件
        if(typeof FlowCommon.dealwithCommonButton === "function"){
            FlowCommon.dealwithCommonButton(this.state,function(extensionButtonList){
                t.dealwithButtonsFunc(content,extensionButtonList);
            },function(error){
                Toast.show({
                    type: 'error',
                    content: error
                 });
            });
        }else{
            t.dealwithButtonsFunc(content,[]);
        }
    }

     //处理button方法
    dealwithButtonsFunc(content,extensionButtonList){
        let t = this;
        var buttons = content.buttons;//按钮
        var startButtons = content.startButtons;//发起人节点按钮配置
        var isStart = content.isStart;//是否是起始节点
        var participantMode = content.participantMode;
        var isDraft = t.state.isDraft;//是否草稿箱，1是，0不是
        var actionSheetButtonOpt = [];
        var no = 0;
        var buttonArray= buttons.split(',');
        var dataId = this.state.dataId;
        var buttonIsMore = false;
        var buttonArrayNew = [];
        var buttonList = [];
        var sysWatermark = this.state.sysWatermark;
        var listType = this.state.listType;
        if(listType == "0"){//待办
            for(var d=0; d<extensionButtonList.length;d++){
                buttonArray.push(extensionButtonList[d].name);
            }
            for(var b=0;b<buttonArray.length;b++){
                var buttonCode = buttonArray[b];
                //PAGE_SAVE保存按钮只有当新建时才有，HELP_ADDLOTS加签只有在会签和串签才有,RADOM_FINISH随机流程完成按钮去掉
                if( buttonCode == 'FLOW_REVOKE' || buttonCode == 'RADOM_FINISH' || buttonCode == 'FLOW_CANCEL'
                	||buttonCode == 'FLOW_RECOVER' || buttonCode == 'PAGE_PRINT' || buttonCode == 'PAGE_URGE' 
                		|| buttonCode == 'PAGE_REDSET'  || buttonCode == 'PAGE_FEEDBACK' || buttonCode == 'RECORD' || buttonCode == 'HELP_FORWARD'
                		|| (buttonCode == 'HELP_ADDLOTS' && (participantMode == '0' || participantMode == '3' )) ){
                    continue;
                }else{
                	if(dataId == '' || isStart== true || isDraft == '1'){
                		if(buttonCode == 'PAGE_SAVE' || buttonCode == 'BASE_SUMBIT'){
                			buttonArrayNew.push(buttonCode);
                		}
                        if(buttonCode.indexOf('PAGE_SAVE')==-1){
                            buttonArrayNew.push('PAGE_SAVE');
                        }
                        if(buttonCode.indexOf('BASE_SUMBIT')==-1){
                            buttonArrayNew.push('BASE_SUMBIT');
                        }
                	}else{
                        if(buttonCode.indexOf('PAGE_SAVE')==-1){
                            buttonArrayNew.push('PAGE_SAVE');
                        }
                        if(buttonCode.indexOf('BASE_SUMBIT')==-1){
                            buttonArrayNew.push('BASE_SUMBIT');
                        }
                		buttonArrayNew.push(buttonCode);
                	}
                }
            }
            this.getListButtonsByCodes(buttonArrayNew.join(','),dataId,isStart);
            
        }else if(listType == "2"){//已办
            	 if(this.state.processIsComplete == "0"){
                     if(buttons.indexOf('FLOW_REVOKE')>=0){
                         if(this.state.processIsComplete == "0"){//当流程未结束时
                        	 buttonList.push({name:t.state.finalButtons.get("FLOW_REVOKE"),type:'secondary',display:'banner',no:7});
                         }
                     }
                     if(buttons.indexOf('FLOW_RECOVER')>=0){
                         if(this.state.processIsComplete == "0"){//当流程未结束时
                        	 buttonList.push({name:t.state.finalButtons.get("FLOW_RECOVER"),type:'secondary',display:'banner',no:14});
                         }
                     }
     	            if(t.state.urgeDataList!=null && t.state.urgeDataList.length>0){
     	            	buttonList.push({name:t.state.finalButtons.get("PAGE_URGE"),type:'secondary',display:'banner',no:12});
     	            }
                 }
            	 if(buttons.indexOf('HELP_CIRCULATE')>=0){
                    	 buttonList.push({name:t.state.finalButtons.get("HELP_CIRCULATE"),type:'secondary',display:'banner',no:4});
                 }
                 for(var d=0; d<extensionButtonList.length;d++){
                     buttonList.push(extensionButtonList[d]);
                 }
        }else if(listType == "4"){//我的
            	   if(this.state.processIsComplete == "0"){//当流程未结束时,
                       if(buttons.indexOf('FLOW_CANCEL')>=0){//取消按钮
                    	   buttonList.push({name:t.state.finalButtons.get("FLOW_CANCEL"),type:'secondary',display:'banner',no:11});
                       }
                       if(startButtons){
                           if(startButtons.indexOf('FLOW_REVOKE')>=0){//发起人撤销按钮
                        	   buttonList.push({name:t.state.finalButtons.get("FLOW_REVOKE"),type:'secondary',display:'banner',no:7});
                           }
                       }
                       if(t.state.urgeDataList!=null && t.state.urgeDataList.length>0){
                    	   buttonList.push({name:t.state.finalButtons.get("PAGE_URGE"),type:'secondary',display:'banner',no:12});
                       }
                   }
            	   if(startButtons){
                       if(startButtons.indexOf('HELP_CIRCULATE')>=0){//传阅
                    	   buttonList.push({name:t.state.finalButtons.get("HELP_CIRCULATE"),type:'secondary',display:'banner',no:4});
                       }
                   }
                   for(var d=0; d<extensionButtonList.length;d++){
                       buttonList.push(extensionButtonList[d]);
                   }
        }else if(listType == "5"){
        	 for(var d=0; d<extensionButtonList.length;d++){
                 buttonArray.push(extensionButtonList[d].name);
             }
             for(var b=0;b<buttonArray.length;b++){
                 var buttonCode = buttonArray[b];
                 if(dataId == '' || isStart== true || isDraft == '1'){
              		if(buttonCode == 'PAGE_SAVE' || buttonCode == 'BASE_SUMBIT'){
              			buttonArrayNew.push(buttonCode);
              		}
              	}
             }
             
            	   for(var c=0; c<buttonArrayNew.length; c++){
                       var buttonCode = buttonArrayNew[c];
                       if(buttonCode=='BASE_SUMBIT'){
                    	   buttonList.push({name:t.state.finalButtons.get("BASE_SUMBIT"),type:'primary',display:'banner',no:1});
                       }else if(buttonCode=='PAGE_SAVE'){
                    	   buttonList.push({name:t.state.finalButtons.get("PAGE_SAVE"),type:'secondary',display:'banner',no:13});
                       }
                   }
        }
        if(listType!='0'){
        	this.setState({
        		buttonList:buttonList,
        		actionSheetButtonOpt:actionSheetButtonOpt,
        		buttonIsMore:buttonIsMore
        	},function(){
        		if(null!=sysWatermark && sysWatermark!=''){
        			$('#sysWatermarkName').val(sysWatermark);
        			showWaterMarker('approveWaterMarker',sysWatermark);
        		}else{
        			$('#sysWatermarkName').val('');
        		}
        	}
        	);
        }
    }

    //表单数据处理回调
    change(data){
        this.setState({
			editFormData:data
        });
      }
    
    //检查表单提交
    checkSubmit(saveTable){
        var mainTblData = saveTable.mainTblData;
        for(var i=0; i<mainTblData.length; i++){
            if(mainTblData[i].required){
                if(!mainTblData[i].value){
                    return mainTblData[i].label;
                }
            }
        }
        return "";
    }
    //检查表单提交
    checkRegularSubmit(saveTable,saveItem){
    	var mainTblData = saveTable.mainTblData;
    	var subTbl=saveTable.subTbl;
    	for(var i=0; i<mainTblData.length; i++){
    		var key=mainTblData[i].key;
    		var value=mainTblData[i].value;
    		if(value!=null && value!=''){
    			for(var j=0;j<saveItem.length;j++){
        			if(key==saveItem[j].itemCode){
        				var validAttr=saveItem[j]['validAttr'];
        			    if(validAttr!=null && validAttr.length>0){
        			    	for(var va=0;va<validAttr.length;va++){
        			    		var regular=validAttr[va]['regular'];
        			    		var tips=validAttr[va]['tips'];
        			    		
        			    		var s=regxp[regular];// datatype默认的校验属性中是否包含
        						if(typeof s !='undefined'){ // 包含则用datatype默认属性校验  形如 ： n  n6-16等  自定义的如n1-2不包含在其中 
        							if(!s.test(value)){return saveItem[j].itemTitle+':'+tips;}
        						}else{
        							var extRegex = /^(.+?)(\d+)-(\d+)$/; //判断是否为 *1-2或n1-2等默认属性的形式
        							var mac=regular.match(extRegex),
        							temp;
        							if(mac){//是默认属性形式则进行扩展
        								var reg = '';
        								for(var name in regxp){//取所有默认属性的名称  进行对比
        									temp=name.match(extRegex);
        									if(!temp){continue;}
        									if(mac[1]===temp[1]){ // 找到同类 如n1-2找到 n6-16时
        										var str=regxp[name].toString(),//取n6-16的对应的实际正则表达  用于替换
        											param=str.match(/\/[mgi]*/g)[1].replace("\/",""),
        											ttregxp=new RegExp("\\{"+temp[2]+","+temp[3]+"\\}","g");
        										str=str.replace(/\/[mgi]*/g,"\/").replace(ttregxp,"{"+mac[2]+","+mac[3]+"}").replace(/^\//,"").replace(/\/$/,"");
        										reg=new RegExp(str,param);//生成新的校验正则表达式
        										break;
        									}
        								}
        								if(reg!=''){//存在时  校验
        									if(!reg.test(value)){return saveItem[j].itemTitle+':'+tips}
        								}else{//不存在时返回未定义
        									return "datatype未定义";
        								}
        							}else{
        								var reg=new RegExp(regular.slice(1,-1),"g"); 
        								if(!reg.test(value)){
        									return saveItem[j].itemTitle+':'+tips;
        								}
        							}
        						}
        			    	}
        			    }
        			}
        		}
    		}
    		
    	}
    	if(subTbl!=null && subTbl.length>0){
    		for(var s=0;s<subTbl.length;s++){
    			var subTblData=subTbl[s].subTblData;
    			var subTblName=subTbl[s].subTblName;
    			for(var i=0; i<subTblData.length; i++){
    				var subTblData1=subTblData[i];
    				if(subTblData1!=null && subTblData1.length>0){
    					for(var m=0;m<subTblData1.length;m++){
    						var key=subTblData1[m].key;
    	    	    		var value=subTblData1[m].value;
    	    	    		if(value!=null && value!=''){
    	    	    			for(var j=0;j<saveItem.length;j++){
        	    	    			var children=saveItem[j]['children'];
        	    	    			var itemTitle=saveItem[j]['itemTitle'];
        	    	    			if(children!=null && children.length>0){
        	    	    				for(var k=0;k<children.length;k++){
        	    	    					if(key==children[k].itemCode && children[k].uniqueName==(subTblName+"_"+key)){
        	    	    						var validAttr=children[k]['validAttr'];
        	    	    	    			    if(validAttr!=null && validAttr.length>0){
        	    	    	    			    	for(var va=0;va<validAttr.length;va++){
        	    	    	    			    		var regular=validAttr[va]['regular'];
        	    	    	    			    		var tips=validAttr[va]['tips'];
        	    	    	    			    		var reg=new RegExp(regular.slice(1,-1),"g"); 
        	    	    	    			    		if(!reg.test(value)){
        	    	    	    			    	          return itemTitle+"  "+children[k].itemTitle+':'+tips;
        	    	    	    			    		}
        	    	    	    			    		
        	    	    	    			    	}
        	    	    	    			    }
        	    	    	    			}
        	    	    				}
        	    	    			}
        	    	    			
        	    	    		}
    	    	    		}
    	    	    		
    					}
    				}
    	    		
    	    	}
    		}
    	}
    	
    	return "";
    }

    /**
     * 提交按钮的点击事件（获得下一个活动节点列表）
     */
    handleSubmit(operate) {
        let t = this;
        // if(operate==1 || operate==5 || operate==13  ){//当不是保存草稿箱时校验必填
        //     var editFormData = this.state.editFormData;
        //     var mainTblData = editFormData.mainTblData;
        //     for(var i=0; i<mainTblData.length; i++){
        //         if(mainTblData[i].inputFormat=='float' || mainTblData[i].inputFormat=='int'){
        //             if(mainTblData[i].value=='-'){
        //             	Toast.show({
        //                     type: 'error',
        //                     content:mainTblData[i].label+"输入错误"
        //                 });
        //                 return false;
        //             }
        //         }
        //     }
        //     var requiredName = this.checkSubmit(editFormData);
        //     if(requiredName != ""){
        //         Toast.show({
        //             type: 'error',
        //             content:requiredName+"不能为空"
        //         });
        //         return false;
        //     }
        //     var formItem =this.state.formItem;
        //     var regularName=this.checkRegularSubmit(editFormData,formItem);
        //     if(regularName != ""){
        //         Toast.show({
        //             type: 'error',
        //             content:regularName
        //         });
        //         return false;
        //     }
            
        // }
        if(operate == 1 || operate==13 ){//当提交时校验form表单
            //表单提交前
           if(typeof FlowCommon.saveBefore === "function"){
               FlowCommon.saveBefore(0,t.state,function(param){
                   t.handleSubmitFunc(operate);
               },function(error){
                   Toast.show({
                       type: 'error',
                       content: error
                   });
               });
           }else{
            t.handleSubmitFunc(operate); 
           }
       }else{
         t.handleSubmitFunc(operate);
       }
    }

    handleSubmitFunc(operate) {
        let t = this;
        var auditorUserIds = null;
        // this.state.personValue.map((item, index) => {
        //     auditorUserIds += (item.key + ',');
        // });
        // if(processType == '2'){//自由流程
        //     var param = {
        //         taskId: this.props.info.taskId,
        //         auditorUserIds: auditorUserIds,
        //         allEditIds:'',
        //         corpId: corpid,
        //         code: this.props.info.code,
        //         formData: JSON.stringify(saveTable),
        //         attachmentList: "",
        //         editType:this.props.info.editType
        //     }
        //     this.sendFlow(param);
        // }else{//固定流程
        var hasCommentField = this.state.hasCommentField;
        if(operate == -1){//更多
            var actionSheetButtonOpt = this.state.actionSheetButtonOpt;
            var actionSheetButtonOptName = this.state.actionSheetButtonOptName;
            ActionSheetButton = ActionSheet.show({ options:actionSheetButtonOptName,maskClosable:true}, (index) => {
                switch(actionSheetButtonOpt[index])
                {
                case 'BASE_SUMBIT':
                t.handleSubmit(1);
                break;
                case 'BASE_SUMBIT':
                t.handleSubmit(1);
                break;
                case 'PAGE_SAVE':
                t.handleSubmit(13);
                break;
                case 'BACK':
                t.handleSubmit(2);
                break;
                case 'BASE_TRANSFER':
                t.handleSubmit(3);
                break;
                case 'HELP_CIRCULATE':
                t.handleSubmit(4);
                break;
                case 'BASE_JUMP':
                t.handleSubmit(5);
                break;
                case 'HELP_ADDLOTS':
                t.handleSubmit(6);
                break;
                case 'FLOW_REVOKE':
                t.handleSubmit(7);
                break;
                case 'BASE_END':
                t.handleSubmit(8);
                break;
                case 'BASE_INVALID':
                t.handleSubmit(9);
                break;
                case 'FLOW_CANCEL':
                t.handleSubmit(11);
                break;
                case 'PAGE_URGE':
                t.handleSubmit(12);
                break;
                case 'FLOW_RECOVER':
                t.handleSubmit(14);
                break;
                default:
                t.handleSubmit(actionSheetButtonOpt[index]);
                break;
                }
              });
        }else if(operate == 1){//提交
            let editFormData = t.state.editFormData;
            let category1 =t.state.category;
            //alert("category1:"+category1);
            var param = {
                taskId: this.state.taskId,
                auditorUserIds: auditorUserIds,
                allEditIds:this.getAllEditIds(t.state.editFormData),
                code: this.state.code,
                category:category1,
                formData: JSON.stringify(editFormData),
                dataId:this.state.dataId,
                editType:this.state.editType,
                module:this.state.module,
                lock:this.state.lock
            }
            var dealActionName = "";
            if(this.state.isStart == true){
                dealActionName = "提交";
            }else{
                dealActionName = this.state.finalButtons.get("BASE_SUMBIT");
            }
            param.dealActionName = dealActionName;
            var nextList = null;//下一个后继节点列表
            var radomList = null;//下一个随机活动节点
            var succeedRange = "";//后继活动id
            var maxOutgoing = null;
            var nextActivityList = [];
            var nextRadomList = [];
            let nextSelectType = '';
            let isEnd = false;
            let hasRadomList = false;//判断下次办理是否有随机活动节点
            var hasCirculate = this.state.buttons.indexOf("HELP_CIRCULATE")>-1;//是否有传阅
            //if(nextActivityList.length==0){ //没有选择提交下一个节点过
                DB.FlowModuleAPI.getNextActivity(param).then((content) => {
                    nextList= content.activityList;
                    succeedRange = content.succeedRange == null?"":content.succeedRange;
                    if(typeof(nextList) == 'undefined' || nextList == null || nextList==''){
                        nextList = [];
                    }
                    radomList = content.radomList;
                    if(typeof(radomList) == 'undefined' || radomList == null || radomList==''){
                        radomList = [];
                    }
                    maxOutgoing=content.maxOutgoing;
                    if(!maxOutgoing){
                        maxOutgoing = "0";
                    }
					if(nextList.length==0 && radomList.length == 0){
                        if(hasCommentField=="1" || hasCirculate == true){//当有批示意见或者传阅时
                            t.setState({
                                pageStatus:'1',
                                operate:operate,
                                urgentHidden:true,
                                urgentList:[]
                            },function(){
                                $(window).scrollTop(0);
                            });
                        }else{
                            t.setState({
                                urgentHidden:true,
                                urgentList:[]
                            });
                            t.sendFlow(param);
                        }
					}else{
                        nextList.sort(function compare(a,b){
                            var val1 = parseInt(a['sortNo']?a['sortNo']:'99999999999999');
                            var val2 = parseInt(b['sortNo']?b['sortNo']:'99999999999999');
                            if (val1 <= val2) {
                                return -1;
                            } else if (val1 > val2) {
                                return 1;
                            } else {
                                return 0;
                            }    
                        });
                        if(nextList.length==1 && nextList[0]['end']){//下一个后继活动是结束
                            isEnd = true;
                            if(hasCommentField=="0" && hasCirculate==false && radomList.length==0){
                                t.setState({
                                    urgentHidden:true,
                                    urgentList:[],
                                    isEnd:isEnd
                                },function(){
                                	param.selectedActivity='[{"id":"end_node","name":"结束","level":""}]';
                                    t.sendFlow(param);
                                });
                                return false;
                            }
                        }
                        //let tasktype = t.state.tasktype;
                        let urgentHidden = false;
                        // var path = '#/approval/approve-choosenode/';
                        let checkActi = "0";//判断是不是默认选中一个节点
                        //hasRadomList = true;//下个节点有随机活动
                        //后继活动
                        let urgentSelectList = [];
                        let urgentList = [];
                        if(nextList.length==1 && nextList[0]['end']){//结束
                            //urgentHidden = true;
                            
                            var endItem = nextList[0];
                            var checkedItem = {};
                            checkedItem.value = endItem.id;
                            checkedItem.name = endItem.name;
                            checkedItem.arrow = true;
                            checkedItem.show = false;
                            checkedItem.type = endItem.type;
                            checkedItem.end = endItem.end;
                            checkedItem.disable = false;
                            checkedItem.maxOutgoing = maxOutgoing;
                            // if(hasRadomList){//当有随机节点时，不选中
                            //     checkedItem.checked = false;
                            // }else{
                                checkedItem.checked = true;
                                checkedItem.must = true;
                                //nextSelectType="next";
                            //}
                            checkedItem.personValue = [];
                            checkedItem.commonUsedData = [];
                            nextActivityList.push(checkedItem);


                            //紧急
                            let urgent = t.state.urgent;
                            urgentList = t.state.urgentList;
                            //if(hasRadomList == false){//当没有随机节点时隐藏紧急
                                urgentHidden = true;
                            //}
                            //if(urgentHidden == false){ //当紧急状态显示时把判断是否选中值
                                if(urgent == '1'){
                                    urgentList[0].checked = true;
                                    urgentSelectList = urgentList;
                                }
                            //}
                            
                        }else{
                            let show = true;
                            var isRadio = maxOutgoing == 1;
                            var no = 0;//随机节点数量
                            nextList.map(function(item){
                                if(item.nodeType=='radom'){//随机

                                    // if(item.must == true){//如果该随机活动必须
                                    //     var id = item.id;
                                    //     // for(var h=0;h<nextRadomList.length;h++){
                                    //     //     if(nextRadomList[h].value==id){//这个随机点必须选一个
                                    //     //         nextRadomList[h].mustHas = true;
                                    //     //     }
                                    //     // }
                                    // }
                                    var nextSucceedRange = "";
                                    var nowLevel = t.state.level;
                                    if(item.id ==  t.state.activityId){//当下个活动节点是当前节点在同一个随机活动时
                                        nextSucceedRange=succeedRange;
                                    }else{
                                        nextSucceedRange="";
                                    }
                                    var returnParam = t.dealwithRadomList(item,radomList,item.must,maxOutgoing,checkActi,nextSucceedRange,nowLevel,no);
                                    ++no;
                                    var randomItem = returnParam.randomItem;
                                    checkActi = returnParam.checkActi;
                                    if(randomItem !=null && randomItem.subRandomList !=null && randomItem.subRandomList.length>0){
                                        nextRadomList.push(randomItem);
                                    }
                                    return false;
                                }
                                var checkedItem = {};
                                var selectUserReadOnly = false;
                                var personValue = [];//选中的人
                                var personValues = [];//备选的人
                                var participantMode = item.participantMode;//判断选人是单选还是多选
                                var commonUsedData = [];//自定义选人的范围,常用
                                var popCode = "";
                                var chooseType = "";
                                var type3ParNum=0;
                                var participantss = item.participantss;
                                    if(item.type == 3 ){ //指定人选择
                                        selectUserReadOnly = true;
                                        popCode = 'org';//选人组件code
                                        chooseType = "userNotOrg"; 
                                        var participantList = item.participantList;
                                        if(participantList != null && participantList != "" && participantList.length>0){
                                            for(var i=0; i<participantList.length; i++ ){
                                                if(participantList[i].type != "user"){
                                                    var children = participantList[i];
                                                    for(var j=0; j<children.length; j++ ){
                                                        var personValueItem = {scopeType:"user",scopeValue:children[j].id,scopeName:children[j].userName,imageId:""};
                                                        personValues.push(personValueItem);
                                                        type3ParNum++;
                                                    }
                                                }else{
                                                    var personValueItem = {scopeType:"user",scopeValue:participantList[i].id,scopeName:participantList[i].name,imageId:""};
                                                    personValues.push(personValueItem);
                                                    type3ParNum++;
                                                }
                                            }
                                            if(type3ParNum>1 && participantMode=='0'){
                                            	item.type =2;
                                            }else{
                                            	personValue=personValues;
                                            }
                                        }
                                        if(type3ParNum==0){
                                        	item.type =1;
                                        }
                                    }
                                    
                                    if(item.type == 1){//选择所有人
                                        selectUserReadOnly = false;
                                        chooseType = "userNotOrg"; 
                                        if(item.nodeType=='readtask'){//如果是传阅节点
                                            chooseType="userNotOrg";
                                        }
                                        var commonUsedId = '';//常用选择范围
                                        var participantList = item.participantList;
                                        if(participantList != null && participantList != "" && participantList.length>0){
                                            for(var i=0; i<participantList.length; i++ ){
                                                if(participantList[i].type != "user"){
                                                    var children = participantList[i];
                                                    for(var j=0; j<children.length; j++ ){
                                                        var personValueItem = {scopeType:participantList[i].type ,scopeValue:children[j].id,scopeName:children[j].userName,imageId:""};
                                                        if(commonUsedId.indexOf(children[j].id) == -1){
                                                            commonUsedId += children[j].id+',';
                                                            commonUsedData.push(personValueItem);
                                                        }
                                                    }
                                                }else{
                                                    var personValueItem = {scopeType:participantList[i].type ,scopeValue:participantList[i].id,scopeName:participantList[i].name,imageId:""};
                                                    if(commonUsedId.indexOf(participantList[i].id) == -1){
                                                        commonUsedId += participantList[i].id+',';
                                                        commonUsedData.push(personValueItem);
                                                    }
                                                }
                                                
                                            }
                                            if(commonUsedData.length>0){
                                                popCode = "common,org";
                                            }else{
                                                popCode = "org";
                                            }
                                        }else{
                                            popCode = "org";
                                        }
                                    }
                                    
                                    if(item.type == 2){//指定候选人
                                        selectUserReadOnly = false;
                                        var popCode = 'common';//选人组件code
                                        var commonUsedId = '';//常用选择范围
                                        var participantList = item.participantList;
                                        if(participantList != null && participantList != "" && participantList.length>0){
                                            for(var i=0; i<participantList.length; i++ ){
                                                if(participantList[i].type != "user"){
                                                    var children = participantList[i];
                                                    for(var j=0; j<children.length; j++ ){
                                                        var personValueItem = {scopeType:"user",scopeValue:children[j].id,scopeName:children[j].userName,imageId:""};
                                                        if(commonUsedId.indexOf(children[j].id) == -1){
                                                            commonUsedId += children[j].id+',';
                                                            commonUsedData.push(personValueItem);
                                                        }
                                                    }
                                                }else{
                                                    var personValueItem = {scopeType:"user",scopeValue:participantList[i].id,scopeName:participantList[i].name,imageId:""};
                                                    if(commonUsedId.indexOf(participantList[i].id) == -1){
                                                        commonUsedId += participantList[i].id+',';
                                                        commonUsedData.push(personValueItem);
                                                    }
                                                }
                                            }
                                        }else{
                                        	item.type =1;
                                        }
                                    }else if(item.type == 4){//办理完毕
                                        commonUsedData=[];
                                        personValue = [];
                                        show = false;
                                        item.end=true;
                                        popCode = '';
                                        chooseType = '';
                                    }
                                    if(item.nodeType=='readtask'){//如果是传阅节点
                                        t.state.isHideRead=true;
                                    }
                                    checkedItem.code = popCode;
                                    checkedItem.chooseType = chooseType;
                                    checkedItem.commonUsedData = commonUsedData;
                                    checkedItem.participantMode = participantMode;//选人单选还是多选，1多选，0单选
                                    checkedItem.personValue = personValue;
                                    checkedItem.selectUserReadOnly = selectUserReadOnly;
                                    checkedItem.value = item.id;
                                    checkedItem.name = item.name;
                                    checkedItem.arrow = true;
                                    checkedItem.show = show;
                                    checkedItem.type = item.type;
                                    checkedItem.end = item.end;
                                    checkedItem.must = item.must;
                                    checkedItem.participantss=participantss;
                                    if(item.end==true){
                                        isEnd = true;
                                    }
                                    checkedItem.level = item.level;
                                    checkedItem.maxOutgoing = maxOutgoing;
                                    if(item.must==true && ((maxOutgoing==1 && checkActi == 0) ||maxOutgoing==0 )){//必须
                                        checkedItem.disable = false;
                                        checkedItem.checked = true;
                                        //nextSelectType = 'next';
                                        checkActi = "1";
                                    }else if(item.defaultFlow==true && ((maxOutgoing==1 && checkActi == 0) ||maxOutgoing==0 ) ){//默认节点
                                        checkedItem.disable = false;
                                        checkedItem.checked = true;
                                        //nextSelectType = 'next';
                                        checkActi = "1";
                                    }else{
                                        checkedItem.disable = false;
                                        checkedItem.checked = false;
                                    }
                                    if(item.type == 4 && radomList.length==0){//当类型是完成结束时且随机活动没有
                                        checkedItem.checked = true;
                                    }
                                    if(checkedItem.checked == true && checkedItem.end==true){ //当结束节点且选中时
                                        // t.setState({
                                        //   urgentHidden:true,
                                        //   urgentList:[]
                                        // });
                                        urgentHidden = true;
                                    }
                                    checkedItem.isRadio = isRadio;//判断是否是单选还是多选
                                    nextActivityList.push(checkedItem);
                                
                            });
                            if(checkActi == "0" && isRadio == true){//如果没有默认选中的下一个节点且是单选，则第一个默认选中
                                if(nextActivityList.length>0 && nextRadomList.length == 0){
                                    nextActivityList[0].checked = true;
                                    //nextSelectType = 'next';
                                }else if(nextRadomList.length>0 && nextActivityList.length == 0){
                                    nextRadomList[0].subRandomList[0].checked = true;
                                    //nextSelectType = 'radom';
                                }
                            }

                            //紧急
                            let urgent = t.state.urgent;
                            urgentList = t.state.urgentList;
                            if(urgentHidden == false){ //当紧急状态显示时把判断是否选中值
                                if(urgent == '1'){
                                    urgentList[0].checked = true;
                                    urgentSelectList = urgentList;
                                }
                            }
                        }
                        t.state.shortMessageList[0].checked=false;   
                        t.state.readShortMessageList[0].checked=false;   
                        t.setState({
                            //nextSelectType:nextSelectType,
                            nextRadomList:nextRadomList,
                            nextActivityList:nextActivityList,
                            pageStatus:'1',
                            operate:operate,
                            urgentSelectList:urgentSelectList,
                            urgentList:urgentList,
                            urgentHidden:urgentHidden,
                            isEnd:isEnd,
                            sendShortMessage:'0',
                            circulateShortMessage:'0'
                        },function(){
                            for(var i=0;i<nextActivityList.length; i++){
                                if(nextActivityList[i].personValue.length>0 || nextActivityList[i].commonUsedData.length>0){
                                    t.refs[nextActivityList[i].value+"_"+i].initSelectData();
                                }
                            }
                            for(var i=0;i<nextRadomList.length; i++){
                                var nextRadomListItem = nextRadomList[i].subRandomList;
                                for(var j=0;j<nextRadomListItem.length; j++){
                                    if(nextRadomListItem[j].personValue.length>0 || nextRadomListItem[j].commonUsedData.length>0){
                                        t.refs[nextRadomListItem[j].value+"_"+j].initSelectData();
                                    }
                                }
                            }
                            $(window).scrollTop(0);
                        });
					}
                }).catch((error) => {
                    if(typeof(error.errorMsg) == 'undefined'){
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: '获取下个办理节点出错',
                                });
                            }, 800);
                    }else{
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: error.errorMsg,
                                });
                            }, 800);
                    }
                });
            // }else{
            //     t.setState({
            //         pageStatus:'1',
            //         operate: operate
            //     },function(){
            //         $(window).scrollTop(0);
            //     });
            // }
        // }
        }else if(operate == 2){//驳回
            let buttons = t.state.buttons;
            var canBackType = '';
            if(buttons!=''){
                var newBut= buttons.split(',');
                var newButCode='';
                for(var b=0;b<newBut.length;b++){
                    if(newBut[b].indexOf('BACK_')==0 && newBut[b].indexOf('BACK_3')!=0){
                        newButCode=newButCode+',BACK';
                        canBackType=newBut[b].replace('BACK_','');
                        canBackType=canBackType.replace(/_/g,',');
                    }
                }
            }
            var selectBackActivity = t.state.selectBackActivity;
            if(selectBackActivity.value == null){ //没有点击过驳回
                DB.FlowModuleAPI.getCanBackActivity({
                    taskId: t.state.taskId,
                    backType:  canBackType
                }).then((content) => {
                    var backList = content.list;
                    if(backList !=null && backList != '' && backList.length>0){
                        var selectOptions = [];
                        backList.map(function(item,index){
                            var option = {};
                            option.value = item.id;
                            option.content = item.name+'('+item.participantNames+')';
                            option.userIds = item.participants;
                            option.disable = false;
                            option.checked = false;
                            option.name =  item.name;
                            option.participantNames = item.participantNames;
                            if(index == 0){
                                option.checked = true;
                            }
                            selectOptions.push(option);
                        });
                        t.state.shortMessageList[0].checked=false;
                        t.setState({
                            canBackActivity:selectOptions,
                            selectBackActivity:selectOptions[0],
                            operate: operate,
                            pageStatus: '1',
                            canBackType:canBackType,
                            backReasonText:'',
                            backShortMessage:'0'
                        },function(){
                            $(window).scrollTop(0);
                        });
                        
                    }else{
                        Toast.show({
                            type: 'error',
                            content: '当前节点不支持'+t.state.finalButtons.get("BACK"),
                        });
                        return false;
                    }
    
                }).catch((error) => {
                    console.error(error);
                });
            }else{
            	t.state.shortMessageList[0].checked=false;
                t.setState({
                    operate: operate,
                    pageStatus: '1',
                    backReasonText:'',
                    backShortMessage:'0'
                },function(){
                    $(window).scrollTop(0);
                });
            }

        }else if(operate == 3){//转交
            //if(hasCommentField=="1"){
        	t.state.shortMessageList[0].checked=false;
            t.setState({
                pageStatus:'1',
                transferShortMessage:'0',
                operate:operate
            },function(){
                $(window).scrollTop(0);
            });
            // }else{
            //     t.transferClick();
            // }
        }else if(operate == 4){//传阅
        	t.state.readShortMessageList[0].checked=false;
            t.setState({
                pageStatus:'1',
                circulateShortMessage:'0',
                operate:operate
            },function(){
                $(window).scrollTop(0);
            });
        }else if(operate == 5){//跳转
            // t.setState({
            //     pageStatus:'1',
            //     operate:operate
            // },function(){
            //     $(window).scrollTop(0);
            // });
            DB.FlowModuleAPI.getCanJumpActivity({
                taskId: t.state.taskId,
            }).then((content) => {
                var jumpList = content;
                if(jumpList !=null && jumpList != '' && jumpList.length>0){
                    var nextJumpActivity = [];
                    jumpList.map(function(item,index){
                        if(item.nodeType != 'initiator' && item.nodeType != 'read'){//当节点不是传阅节点
                            var option = {};
                            option.value = item.id;
                            option.content = item.name;
                            option.disable = false;
                            option.checked = false;
                            option.participantMode = item.participantMode;//单选多选，0是单选，其他多选
                            nextJumpActivity.push(option);
                        }
                    });
                    if(nextJumpActivity.length==0){
                        Toast.show({
                            type: 'error',
                            content: '无可'+t.state.finalButtons.get("BASE_JUMP")+'的节点',
                        });
                        return false;
                    }else{
                        nextJumpActivity[0].checked=true;
                        t.state.shortMessageList[0].checked=false;
                        t.setState({
                            nextJumpActivity:nextJumpActivity,
                            selectJumpActivity:nextJumpActivity[0],
                            operate: operate,
                            pageStatus: '1',
                            jumpShortMessage: '0',
                        });
                        $(window).scrollTop(0);
                    }
                    
                }else{
                    Toast.show({
						type: 'error',
						content: '无可'+t.state.finalButtons.get("BASE_JUMP")+'的节点',
					});
                    return false;
                }
            }).catch((error) => {
                console.error(error);
            });
        }else if(operate == 6){//加签
        	t.state.shortMessageList[0].checked=false;
            t.setState({
                pageStatus:'1',
                backShortMessage:'0',
                operate:operate
            },function(){
                $(window).scrollTop(0);
            });
        }else if(operate == 7){//撤销
            this.recallClick();
        }else if(operate == 8){//结束
            this.handleEnd();
        }else if(operate == 9){//作废
            this.handleInvalid();
        }else if(operate == 10){//完成
            this.handleFinish();
        }else if(operate == 11){//取消
            this.cancelClick();
        }else if(operate == 12){//催办
        		 t.setState({
                     pageStatus: '1',
                     operate:12,
                     urgeContent:'',
                 });
        		 t.state.selectUrgeActivity=[];
        		 for(var n=0;n<t.state.urgeDataList.length;n++){
        			 t.state.urgeDataList[n].checked=false;
        		 }
        		 t.state.reminders=[];
        		 for(var n=0;n<t.state.remindersList.length;n++){
        			 t.state.remindersList[n].checked=false;
        		 }
        		 
        		 $(window).scrollTop(0);
        }else if(operate == 13){//保存
            this.saveForm();
        }else if(operate == 14){//收回
        	 DB.FlowModuleAPI.canRollback({
                 taskId: t.state.taskId,
             }).then((content) => {
            	 if(content.data==true){
            		 t.setState({
                         pageStatus: '1',
                         operate:14,
                         recoverReasonText:'',
                     });
            	 }else{
            		 Toast.show({
  						type: 'error',
  						content: content.message.replace('!','').replace('！',''),
  					});
                    return false; 
            	 }
            	 
             }).catch((error) => {
                 console.error(error);
             });	 
        }else{//其他按钮
            if(typeof FlowCommon[operate] === "function"){
                FlowCommon[operate](this.state
                ,function(msg){
                    Toast.show({
						type: 'success',
						content: msg,
					});
                },function(msg){
                    Toast.show({
						type: 'error',
						content: msg,
					});
                });
            }
        }
    }
    
    //处理后面的待办节点随机节点
    dealwithRadomList(randomMain,radomList,isMust,maxOutgoing,checkActi,succeedRange,nowLevel,no){
        if(nowLevel==null){
            nowLevel = "0";
        }
        var id = randomMain.id;
        var randomItem={};
        randomItem.id = id;
        randomItem.name = randomMain.name;
        var subRandomList = [];
        //随机节点
        if(typeof(radomList)!= 'undefined' && radomList != null){
            var radomIsRadio = true;
            if(radomList.length>0){
                //
                radomList.map(function(item,m){
                    if(item.id == id){//当子随机活动id等于主随机id
                        var checkedItem = {};
                        var selectUserReadOnly = false;
                        var personValue = [];//选中的人
                        radomIsRadio = item.isCross == 2?false:true;//判断选人是单选还是多选,isCross 0,1单选，2包含随机多选
                        var participantMode = item.participantMode;
                        var commonUsedData = [];//自定义选人的范围,常用
                        var popCode = "";
                        var chooseType = "";
                        var participantList=[];//参与人
                        if(item.type == 3 ){ //指定人选择
                            selectUserReadOnly = true;
                            popCode = 'org';//选人组件code
                            chooseType = "userNotOrg"; 
                            if(succeedRange == "" || item.level != parseInt(nowLevel)+1){//当后继为空时取下个活动的
                                participantList = item.participantList;
                            }else{
                                participantList = getUsersByOrgGroupIds(succeedRange);
                            }
                            if(participantList != null && participantList != "" && participantList.length>0){
                                for(var i=0; i<participantList.length; i++ ){
                                    if(participantList[i].type != "user"){
                                        var children = participantList[i];
                                        for(var j=0; j<children.length; j++ ){
                                            var personValueItem = {scopeType:"user",scopeValue:children[j].id,scopeName:children[j].userName,imageId:""};
                                            personValue.push(personValueItem);
                                        }
                                    }else{
                                        var personValueItem = {scopeType:"user",scopeValue:participantList[i].id,scopeName:participantList[i].name,imageId:""};
                                        personValue.push(personValueItem);
                                    }
                                }
                            }
                        }else if(item.type == 1){//选择所有人
                            selectUserReadOnly = false;
                            chooseType = "userNotOrg"; 
                            var commonUsedId = '';//常用选择的用户id
                            if(succeedRange == "" || item.level != parseInt(nowLevel)+1){//当后继为空时取下个活动的
                                participantList = item.participantList;
                            }else{
                                participantList = getUsersByOrgGroupIds(succeedRange);
                            }
                            if(participantList != null && participantList != "" && participantList.length>0){
                                for(var i=0; i<participantList.length; i++ ){
                                    if(participantList[i].type != "user"){
                                        var children = participantList[i];
                                        for(var j=0; j<children.length; j++ ){
                                            var personValueItem = {scopeType:"user",scopeValue:children[j].id,scopeName:children[j].userName,imageId:""};
                                            if(commonUsedId.indexOf(children[j].id) == -1){
                                                commonUsedId += children[j].id+',';
                                                commonUsedData.push(personValueItem);
                                            }
                                        }
                                    }else{
                                        var personValueItem = {scopeType:"user",scopeValue:participantList[i].id,scopeName:participantList[i].name,imageId:""};
                                        if(commonUsedId.indexOf(participantList[i].id) == -1){
                                            commonUsedId += participantList[i].id+',';
                                            commonUsedData.push(personValueItem);
                                        }
                                    }
                                }
                                if(commonUsedData.length>0){
                                    popCode = "common,org";
                                }else{
                                    popCode = "org";
                                }
                            }else{
                                popCode = "org";
                            }
                        }else{//指定候选人
                            selectUserReadOnly = false;
                            var popCode = 'common';//选人组件code
                            var commonUsedId = '';//常用选择的用户id
                            if(succeedRange == "" || item.level != parseInt(nowLevel)+1){//当后继为空时取下个活动的
                                participantList = item.participantList;
                            }else{
                                participantList = getUsersByOrgGroupIds(succeedRange);
                            }
                            if(participantList != null && participantList != "" && participantList.length>0){
                                for(var i=0; i<participantList.length; i++ ){
                                    if(participantList[i].type != "user"){
                                        var children = participantList[i];
                                        for(var j=0; j<children.length; j++ ){
                                            var personValueItem = {scopeType:"user",scopeValue:children[j].id,scopeName:children[j].userName,imageId:""};
                                            if(commonUsedId.indexOf(children[j].id) == -1){
                                                commonUsedId += children[j].id+',';
                                                commonUsedData.push(personValueItem);
                                            }
                                        }
                                    }else{
                                        var personValueItem = {scopeType:"user",scopeValue:participantList[i].id,scopeName:participantList[i].name,imageId:""};
                                        if(commonUsedId.indexOf(participantList[i].id) == -1){
                                            commonUsedId += participantList[i].id+',';
                                            commonUsedData.push(personValueItem);
                                        }
                                    }
                                }
                            }
                        }
                        checkedItem.code = popCode;
                        checkedItem.chooseType = chooseType;
                        checkedItem.commonUsedData = commonUsedData;
                        checkedItem.participantMode = participantMode;//选人单选还是多选，1多选，0单选
                        checkedItem.personValue = personValue;
                        checkedItem.selectUserReadOnly = selectUserReadOnly;
                        checkedItem.value = item.id;
                        checkedItem.name = item.name;
                        checkedItem.arrow = true;
                        checkedItem.show = true;
                        checkedItem.type = item.type;
                        checkedItem.end = item.end;
                        checkedItem.level = item.level;
                        checkedItem.maxOutgoing = maxOutgoing;
                        if(no==0 && m==0 ){//随机节点第一个默认选中
                            if(maxOutgoing != 1 || (maxOutgoing == 1 &&checkActi == '0')){
                                
                                checkedItem.disable = false;
                                checkedItem.checked = true;
                                //nextSelectType = 'radom';
                                checkActi = "1";
                            }else{
                                checkedItem.disable = false;
                                checkedItem.checked = false;
                            }
                        }else{
                            checkedItem.disable = false;
                            checkedItem.checked = false;
                        }
    
                        if(item.must == true){
                            checkedItem.disable = false;
                            checkedItem.checked = true;
                            checkedItem.must = true;
                            checkActi = "1";
                        }
                        checkedItem.isRadio = radomIsRadio;//判断是否是单选还是多选
                        checkedItem.mustHas = isMust;//随机节点是不是必须
                        subRandomList.push(checkedItem);
                    }
                });
            }
        }

        randomItem.subRandomList=subRandomList;
        var returnParam ={};
        returnParam.checkActi = checkActi;
        returnParam.randomItem = randomItem;
        return returnParam;
    }
    
    //点击已阅
    clickRead(){
        if(this.state.hasCommentField == '1'){
            this.setState({
                pageStatus:'1',
                operate:11
            },function(){
                $(window).scrollTop(0);
            });
        }else{
            this.confirmRead();
        }
    }
    //已阅
	confirmRead(){
        let t = this;
        var isPush = t.state.isPush;
        var _thirdMenuType =t.state.thirdMenuType;
		var db = DB;
		Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
			content: '确定已阅吗？',
			onConfirm() {
				db.FlowModuleAPI.readCompleteTask({
					dataId: t.state.dataId,
					taskId: t.state.taskId,
					permissionCode: t.state.permissionCode,
					processInstanceId:t.state.processInstanceId,
					allEditIds:t.getAllEditIds(t.state.editFormData),
					editType:t.state.editType,
					formData: JSON.stringify(t.state.editFormData),
                    module:t.state.module,
                    comment:t.state.spyj
				}).then((content) => {
					Toast.show({
						type: 'success',
						content: '已阅成功',
					});
					if (isPush == '1') {
						//alert("_thirdMenuType:"+_thirdMenuType);
                        //不得已的办法
                        if(_thirdMenuType == 'WX'){
                            //$('#readDiv').hide();
                            setTimeout(
                                function () {
                                    wx.closeWindow();
                                    window.close();
                                }, 1500);
                        }else{
                            backPage();
                        }
					} else {
						setTimeout(
							function () {
								history.back();
							}, 1500);
					}
				}).catch((error) => {
					setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: error.errorMsg,
                            });
                        }, 800);
				});
			},
			onCancel() {
			  console.log('confirm cancel');
			},
		  });
	}
	

	//传阅流程
	circulated(){
        let t= this;
        setTimeout(function(){
            t.refs.selectMember_circulate.clickAdd();
        },500);
    }
    

    //获取所有表单id，包括子表id
    getAllEditIds(data){
        var allEditIdsArray = [];
        
        //主表id
        var mainTableId = data.dataId;
        allEditIdsArray.push(mainTableId);

        //子表id
        var subTbl = data.subTbl;
        for(var i=0;i<subTbl.length; i++){
            var subTableItem = subTbl[i];
            var subTblData = subTableItem.subTblData;
            if(subTblData && subTblData.length>0){
                for(var j=0;j<subTblData.length; j++){
                    var subTblDataItem = subTblData[j];
                    var id = "";
                    for(var m=0;m<subTblDataItem.length; m++){
                        if(subTblDataItem[m].key == 'id'){
                            if(subTblDataItem[m].value){
                                allEditIdsArray.push(subTblDataItem[m].value);
                            }
                        }
                    }
                }
            }
        }
        if(subTbl.length>0){
            allEditIdsArray.push(mainTableId);
        }
        
        var allEditIds = '';
        allEditIdsArray.map(function(item){
            allEditIds+=item+',';
        });
        if(allEditIds){
            allEditIds = allEditIds.substring(0,allEditIds.length-1);
        }
        return allEditIds;
    }
    
    //流程加签
	addSign(){
        let t = this;
        setTimeout(function(){
            t.refs.selectMember_addSign.clickAdd();
        },500);
    }

    //获取下一个节点提交
    handleSubmitClick(){
        let t = this;
        let operate = this.state.operate;
        let commentIsNull = t.state.commentIsNull;
        let commentIsNotNull = t.state.commentIsNotNull;
        let hasCommentField = t.state.hasCommentField;
        let comment = t.state.spyj;
        let category1 =t.state.category;
        if(operate == 1 || operate == 10){
        	if(comment != ''){
                if(comment.length>200){
                    Toast.show({
                        type: 'error',
                        content: '意见不能多于200字！',
                    });
                    return false;
                }
            }else if(hasCommentField=='1'){
                if(commentIsNull == '1' || commentIsNotNull=='1'){//不可为空
                    Toast.show({
                        type: 'error',
                        content: '意见不能为空！',
                    });
                    return false;
                }
            }
        	//判断是否保存常用语
            let savePhrase = this.state.savePhrase;
            if(savePhrase.length>0 && comment != ''){
                DB.FlowModuleAPI.savePersonalPhrase({
                    content:comment
                }).then((content) => {
                }).catch((error) => {
                    console.error(error);
                });
            }
        }
        //alert("handleSubmitClick operate:"+operate);
        if(operate == 1){//审批提交
            var editFormData = this.state.editFormData;
            var nextRadomListSelect = this.state.nextRadomList;
            var nextActivityListSelect = this.state.nextActivityList;
            var selectedActivity = '';
            
            if(nextRadomListSelect.length>0 || nextActivityListSelect.length>0){ //下一个节点不为空时
                var nextActivityList = [];
                selectedActivity = '';
                nextRadomListSelect.map(function(item){
                    nextActivityList = nextActivityList.concat(item.subRandomList);
                });
                nextActivityList = nextActivityList.concat(nextActivityListSelect);
                for(let i=0;i<nextActivityList.length;i++){
                    var auditorUserIds = '';
                    var auditorUserNames = '';
                    var checked = nextActivityList[i].checked;
                    if(checked){
                        var personValue = nextActivityList[i].personValue;
                        var isEnd=nextActivityList[i].end;
                        
                        if(personValue.length<=0 && !isEnd){
                            Toast.show({
                                type: 'error',
                                content: '请选择审批人'
                            });
                            return false;
                        }
                        var participantMode = nextActivityList[i].participantMode;
                        if(participantMode == 0){
                            if(personValue.length>1){
                                Toast.show({
                                    type: 'error',
                                    content: nextActivityList[i].name+'节点的参与人只能是单人，请重新设置流程！'
                                });
                                return false;
                            }
                        }
                        if(!isEnd){
                            let selectUserIds = '';
                            let selectOrgIds = ''
                            personValue.map((item, index) => {
                                if(selectUserIds.indexOf(item.scopeValue) == -1){
                                    if(item.scopeType=='user'){//用户
                                        selectUserIds +=item.scopeValue+",";
                                        auditorUserIds += (item.scopeValue + ',');
                                        auditorUserNames +=(item.scopeName+',');
                                    }else if(item.scopeType=='org'){//组织
                                        selectOrgIds += item.scopeValue+",";
                                    }
                                }
                            });
                            if(selectOrgIds != ''){
                                selectOrgIds = selectOrgIds.substring(0,selectOrgIds.length-1);
                                var orgUserList = getUsersByOrgIDs(selectOrgIds);
                                var orgUserids = ''; 
                                var orgUsernames = '';
                                for(var j=0; j<orgUserList.length; j++){
                                    if(auditorUserIds.indexOf(orgUserList[j].id)<0){
                                        orgUserids += orgUserList[j].id+",";
                                        orgUsernames += orgUserList[j].userName+",";
                                    }
                                }
                                auditorUserIds += orgUserids;
                                auditorUserNames += orgUsernames;
                            }
                            if(auditorUserIds != ''){
                                auditorUserIds = auditorUserIds.substring(0,auditorUserIds.length-1);
                                auditorUserNames = auditorUserNames.substring(0,auditorUserNames.length-1);
                            }
                            var level = nextActivityList[i].level;
                            if(level == null){
                                level = "";
                            }
                            
                            selectedActivity += '{"id":"'+nextActivityList[i].value+'","name":"'+nextActivityList[i].name+'","participants":"'+auditorUserIds+'","participantNames":"'+auditorUserNames+'","level":"'+level+'"},'; 
                           
                        }else{
                            var level = nextActivityList[i].level;
                            if(level == null){
                                level = "";
                            }
                            selectedActivity += '{"id":"'+nextActivityList[i].value+'","name":"'+nextActivityList[i].name+'","level":"'+level+'"},'; 
                            
                        }
                    }
                }
                if(selectedActivity != ''){
                    selectedActivity = selectedActivity.substring(0,selectedActivity.length-1);
                    selectedActivity = '['+selectedActivity+']';
                }else{
                    Toast.show({
                        type: 'error',
                        content: '请选择节点'
                    });
                    return false;
                }
            }
            let urgentListSelect = t.state.urgentSelectList;
            let urgent = '';
            for(let i=0;i<urgentListSelect.length;i++){
                urgent += urgentListSelect[i].value+",";
            }
            if(urgent != ''){
                urgent = urgent.substring(0,urgent.length-1);
            }
            if(urgent == '' && t.state.urgentHidden==false){
                urgent='0';
            }
            var sshortMessage='0';
            var sendShortMessage = t.state.sendShortMessage;
            if(sendShortMessage.length>0){
            	sshortMessage=sendShortMessage[0].value;
            }
            var cshortMessage='0';
            var circulateShortMessage = t.state.circulateShortMessage;
            if(circulateShortMessage.length>0){
            	cshortMessage=circulateShortMessage[0].value;
            }
            var param = {
                taskId: this.state.taskId,
                selectedActivity: selectedActivity,
                allEditIds:this.getAllEditIds(t.state.editFormData),
                corpId: corpid,
                code: this.state.code,
                formData: JSON.stringify(editFormData),
                module:t.state.module,
                category:category1,
                comment:t.state.spyj,
                hasCommentField:t.state.hasCommentField,
                dataId:t.state.dataId,
                urgent:urgent,
                lock:t.state.lock,
                sendShortMessage:sshortMessage,
                circulateShortMessage:cshortMessage
            }
            var dealActionName = "";
            if(this.state.isStart == true){
                dealActionName = "提交";
            }else{
                dealActionName = '通过';
            }
            param.dealActionName = dealActionName;
            this.sendFlow(param);
        }else if(operate == 2){//退回
            let buttons = this.state.buttons;
            var backReasonText=this.state.backReasonText;
            if(backReasonText==null || backReasonText=='' ){
                Toast.show({
                    type: 'error',
                    content: '退回原因不能为空'
                });
                return false;
            }
            if(buttons != ''){ //按钮不为空
                let backTypeListSelect = t.state.backTypeSelectList;
                let backType = '';
                for(let i=0;i<backTypeListSelect.length;i++){
                    backType += backTypeListSelect[i].value+",";
                }
                if(backType != ''){
                    backType = backType.substring(0,backType.length-1);
                }
                var selectBackActivity = this.state.selectBackActivity;
                var shortMessage='0';
                var backShortMessage = this.state.backShortMessage;
                if(backShortMessage.length>0){
                	shortMessage=backShortMessage[0].value;
                }
                var param = {
                    taskId: this.state.taskId,
                    dataId:this.state.dataId,
                    formId:this.state.formId,
                    permissionCode:this.state.permissionCode,
                    targetId: selectBackActivity.value,
                    targetName: selectBackActivity.name,
                    backType:backType,
                    targetUserId: selectBackActivity.userIds,
                    targetUserName: selectBackActivity.participantNames,
                    module:this.state.module,
                    hasCommentField:t.state.hasCommentField,
                    processInstanceId:this.state.processInstanceId,
                    backReasonText:this.state.backReasonText,
                    shortMessage:shortMessage
                }
                this.backFlow(param);
            }
            
        }else if(operate == 3){//转交
            this.transferClick();
        }else if(operate == 5){//跳转
            this.jump();
        }else if(operate == 10){//随机节点结束
            var editFormData = this.state.editFormData;
            var sshortMessage='0';
            var sendShortMessage = t.state.sendShortMessage;
            if(sendShortMessage.length>0){
            	sshortMessage=sendShortMessage[0].value;
            }
            var cshortMessage='0';
            var circulateShortMessage = t.state.circulateShortMessage;
            if(circulateShortMessage.length>0){
            	cshortMessage=circulateShortMessage[0].value;
            }
            var param = {
                taskId: this.state.taskId,
                selectedActivity:'',
                allEditIds:this.getAllEditIds(t.state.editFormData),
                corpId: corpid,
                code: this.state.code,
                formData: JSON.stringify(editFormData),
                module:t.state.module,
                comment:t.state.spyj,
                hasCommentField:t.state.hasCommentField,
                dataId:t.state.dataId,
                lock:t.state.lock,
                sendShortMessage:sshortMessage,
                circulateShortMessage:cshortMessage
            }
            var dealActionName = "完成";
            param.dealActionName = dealActionName;
            this.sendFlow(param);
        }else if(operate == 11){//已阅
            this.confirmRead();
        }else if(operate == 12){//催办
            this.urgeFlow();
        }else if(operate == 6){//加签
            this.addlots();
        }else if(operate == 4){//传阅
            this.circulateNode();
        }else if(operate == 14){//收回
        	var recoverReasonText=this.state.recoverReasonText;
            if(recoverReasonText==null || recoverReasonText=='' ){
                Toast.show({
                    type: 'error',
                    content: '收回原因不能为空'
                });
                return false;
            }
        	var param = {
                    taskId: this.state.taskId,
                    permissionCode:this.state.permissionCode,
                    module:this.state.module,
                    processInstanceId:this.state.processInstanceId,
                    recoverReasonText:this.state.recoverReasonText
                }
            this.recoverFlow(param);
        }
    }

    //驳回流程
    backFlow(param){
        let db = DB;
        let t = this;
        //var isPush = '0';
        param.processInstanceId = this.state.processInstanceId;
        if(t.state.listType == '0') param.permissionCode = 'pending';
        Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
            content: '是否要'+t.state.finalButtons.get("BACK")+'审批？',
            onConfirm() {
                db.FlowModuleAPI.back(param).then((content) => {
                    Toast.show({
                        type: 'success',
                        content: t.state.finalButtons.get("BACK")+'成功'
                    });
                    //操作回调
                    if(content.isStart == '1' && typeof FlowCommon.operateCallBack === "function"){
                        let dataId = t.state.dataId;
                        FlowCommon.operateCallBack({type:0,dataId:dataId,isBatch:0},t.state);
                    }
                    setTimeout(
                        function () {
                            backPage();
                        }, 1500);
        
                }).catch((error) => {
                    setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: error.errorMsg,
                            });
                        }, 800);
                });
            },
            onCancel() {
            },
        });
    }

    //收回流程
    recoverFlow(param){
        let db = DB;
        let t = this;
        Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
            content: '是否要'+t.state.finalButtons.get("FLOW_RECOVER")+'审批？',
            onConfirm() {
                db.FlowModuleAPI.rollback(param).then((content) => {
                    Toast.show({
                        type: 'success',
                        content: t.state.finalButtons.get("FLOW_RECOVER")+'成功'
                    });
                    
                    setTimeout(
                        function () {
                            backPage();
                        }, 1500);
        
                }).catch((error) => {
                    setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: error.errorMsg,
                            });
                        }, 800);
                });
            },
            onCancel() {
            },
        });
    }
    //下一个节点取消
    cancelActivity(){
        this.setState({
            pageStatus:'0'
        });
    }

    //保存表单
    saveForm(){
        let t = this;
        //表单提交前
        
        if(typeof FlowCommon.saveBefore === "function"){
            FlowCommon.saveBefore(2,t.state,function(param){
                t.saveFormFuc();
            },function(error){
                Toast.show({
                    type: 'error',
                    content: error
                });
            });
        }else{
            t.saveFormFuc();
        }
    }

    //保存表单方法
    saveFormFuc(){
        let t = this;
        let db = DB;
        var editFormData = this.state.editFormData;
        let mtd = editFormData.mainTblData;
        for(let i = 0; i < mtd.length; i++){//这三个值不用记录日志，所以把值清空
            let item = mtd[i];
            if(item.key == 'interval_date' || item.key == 'repetitive_week' || item.key == 'repetitive_month'){
                mtd.splice(i, 1);
                i--;
            }
        }
        var param = {
            taskId: this.state.taskId,
            module:t.state.module,
            processInstanceId:t.state.processInstanceId,
            allEditIds:t.getAllEditIds(t.state.editFormData),
            formData: JSON.stringify(editFormData),
            formType:"4",
            editType:this.state.editType,
            module:t.state.module,
            permissionCode:t.state.permissionCode,
            hasCommentField:t.state.hasCommentField,
            dataId:t.state.dataId
        }
        if(t.state.dataId!='' && t.state.dataId!=null){
            if(t.state.listType == '0') param.permissionCode = 'pending';
        	db.FlowModuleAPI.saveForm(param).then((content) => {
                Toast.show({
                    type: 'success',
                    content: '保存成功'
                });

                //操作回调
                if(typeof FlowCommon.operateCallBack === "function"){
                    let dataId = content.dataId;
                    FlowCommon.operateCallBack({type:5,dataId:dataId,isBatch:0},t.state);
                }
                setTimeout(
                    function () {
                        backPage();
                    }, 1500);
            }).catch((error) => {
                if(typeof(error.errorMsg) == 'undefined'){
                    setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: '保存出错',
                            });
                        }, 800);
                }else{
                    var message = error.errorMsg;
                    if(message.indexOf('exclusive gateway')!=-1){
                        message="请检查判断条件字段是否正确填写！";
                    }
                    setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content:message,
                            });
                        }, 800);
                }
            });
        }else{
        	 Dialog.confirm({
                 locale: 'zh_CN',
                 title: '提示',
                 content: '是否保存到草稿箱',
                 onConfirm() {
                     db.FlowModuleAPI.saveForm(param).then((content) => {
                         Toast.show({
                             type: 'success',
                             content: '保存成功'
                         });

                         //操作回调
                         if(typeof FlowCommon.operateCallBack === "function"){
                             let dataId = content.dataId;
                             FlowCommon.operateCallBack({type:5,dataId:dataId,isBatch:0},t.state);
                         }
                         setTimeout(
                             function () {
                                 backPage();
                             }, 1500);
                     }).catch((error) => {
                         if(typeof(error.errorMsg) == 'undefined'){
                             setTimeout(
                                 function () {
                                     Toast.show({
                                         type: 'error',
                                         content: '保存出错',
                                     });
                                 }, 800);
                         }else{
                             var message = error.errorMsg;
                             if(message.indexOf('exclusive gateway')!=-1){
                                 message="请检查判断条件字段是否正确填写！";
                             }
                             setTimeout(
                                 function () {
                                     Toast.show({
                                         type: 'error',
                                         content:message,
                                     });
                                 }, 800);
                         }
                     });
                 },
             onCancel() {
                 console.log('confirm cancel');
                 },
             });
        }
    }

    //提交发送流程
    sendFlow(params){
        let t = this;
        //表单提交前
        if(typeof FlowCommon.saveBefore === "function"){
            FlowCommon.saveBefore(1,params,function(param){
                t.sendFlowFuc(param);
            },function(error){
                Toast.show({
                    type: 'error',
                    content: error
                });
            });
        }else{
            t.sendFlowFuc(params);
        }
    }
    
    //发送流程function
    sendFlowFuc(param){
        let t = this;
        //传阅人
        var circulatePersonValue = t.state.circulatePersonValue;
        var isPush = t.state.isPush;
        var _thirdMenuType =t.state.thirdMenuType;
        var assignId = "";
        var assignName = "";
        var orgIds = "";
        if(circulatePersonValue.length>0){
            circulatePersonValue.map((item, index) => {
                if(item.scopeType=='org'){
                    orgIds  += (item.scopeValue + ',');
                }else if(item.scopeType=='user'){
                    assignId  += (item.scopeValue + ',');
                    assignName +=(item.scopeName+',');
                }
            });
            if(orgIds != ''){
                orgIds = orgIds.substring(0,orgIds.length-1);
                var orgUserList = getUsersByOrgIDs(orgIds);
                var orgUserids = ''; 
                var orgUsernames = '';
                for(var j=0; j<orgUserList.length; j++){
                    if(assignId.indexOf(orgUserList[j].id)<0){
                        orgUserids += orgUserList[j].id+",";
                        orgUsernames += orgUserList[j].userName+",";
                    }
                }
                assignId += orgUserids;
                assignName += orgUsernames;
            }
            if(assignId){
                assignId = assignId.substring(0,assignId.length-1);
                assignName = assignName.substring(0,assignName.length-1);
            }
        }
        param.circulateIds = assignId;
        param.circulateNames = assignName;

        var editType = t.state.editType;
        // if(t.state.dataId == ''){
        //     editType = "add";
        // }else{
        //     editType = 'edit';
        // }
        param.editType = editType;
        param.processInstanceId = this.state.processInstanceId;
        if(editType == 'add') param.permissionCode = 'start';
        else if(t.state.listType == '0') param.permissionCode = 'pending';
        else if(t.state.listType == '5') param.permissionCode = 'draft';
        //var tasktype = this.state.tasktype;
        var content = '是否要通过审批？';
        if(param.dealActionName=='完成'){//随机流程
            content = '是否要完成审批？';
        }else if(editType == 'add'){//新增
            content = '是否要提交审批？';
        }
        param.processInstanceId=t.state.processInstanceId;
        param.permissionCode=t.state.permissionCode;
        let editFormData = JSON.parse(param.formData);
        let mtd = editFormData.mainTblData;
        for(let i = 0; i < mtd.length; i++){//这三个值不用记录日志，所以把值清空
            let item = mtd[i];
            if(item.key == 'interval_date' || item.key == 'repetitive_week' || item.key == 'repetitive_month'){
                mtd.splice(i, 1);
                i--;
            }
        }
        param.formData = JSON.stringify(editFormData);
        let db = DB;
        Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
            content: content,
            onConfirm() {
                db.FlowModuleAPI.sendFlow(param).then((content) => {
                    Toast.show({
                        type: 'success',
                        content: '提交成功'
                    });

                    //操作回调
                    if(typeof FlowCommon.operateCallBack === "function"){
                        var type = 6;
                        if(t.state.isStart){//是不是起始节点
                            type = 4;
                        }else if(t.state.isEnd){//是不是结束节点
                            type = 1;
                        }
                        if(type > 0){
                            let dataId = t.state.dataId;
                            if(dataId == ""){
                                dataId = content.dataId;
                            }
                            FlowCommon.operateCallBack({type:type,dataId:dataId,isBatch:0},t.state);
                        }
                    }

                    if (isPush == '1') {
                        //alert("_thirdMenuType:"+_thirdMenuType);
                        //不得已的办法
                        if(_thirdMenuType == 'WX'){
                            setTimeout(
                                function () {
                                    wx.closeWindow();
                                    window.close();
                                }, 1500);
                        }else{
                            setTimeout(
                                function () {
                                    backPage();
                                }, 1500);
                        }
					} else {
						setTimeout(
                            function () {
                                backPage();
                            }, 1500);
					}
                }).catch((error) => {
                    if(typeof(error.errorMsg) == 'undefined'){
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: '提交出错',
                                });
                            }, 800);
                    }else{
                        var message = error.errorMsg;
                        if(message.indexOf('exclusive gateway')!=-1){
                            message="请检查判断条件字段是否正确填写！";
                        }
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: message,
                                });
                            }, 800);
                    }
                });
            },
        onCancel() {
            console.log('confirm cancel');
            },
        });
    }
    
    
    //结束流程
    handleEnd(){
        let t = this;
		var isPush = t.state.isPush;
        var db = DB;
        
        Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
            content: '是否要'+t.state.finalButtons.get("BASE_END")+'审批？',
            onConfirm() {
                db.FlowModuleAPI.forceEnd({
                    taskId: t.state.taskId,
                    processInstanceId:t.state.processInstanceId,
                    module:t.state.module,
                    permissionCode:t.state.permissionCode
                }).then((content) => {
                    Toast.show({
                        type: 'success',
                        content: t.state.finalButtons.get("BASE_END")+'成功',
                    });
                    //操作回调
                    if(typeof FlowCommon.operateCallBack === "function"){
                        let dataId = t.state.dataId;
                        FlowCommon.operateCallBack({type:7,dataId:dataId,isBatch:0},t.state);
                    }
                    if (isPush == '0') {
                        setTimeout(
                            function () {
                                history.back();
                            }, 1500);
                    } else {
                        backPage();
                    }

                }).catch((error) => {
                    setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: error.errorMsg,
                            });
                        }, 800);
                });
            },
            onCancel() {
            console.log('confirm cancel');
            },
        });
    }

    //完成
    handleFinish(){
        let t = this;
        var hasCommentField = this.state.hasCommentField;//是否有审批意见
        if(hasCommentField=="1"){//有批示意见
            t.setState({
                pageStatus:'1',
                operate:10
            },function(){
                $(window).scrollTop(0);
            });
        }else{
            var editFormData = this.state.editFormData;
            var param = {
                taskId: this.state.taskId,
                allEditIds:this.getAllEditIds(t.state.editFormData),
                code: this.state.code,
                formData: JSON.stringify(editFormData),
                dataId:this.state.dataId,
                editType:this.state.editType,
                module:t.state.module,
                dealActionName:'完成'
            }
            t.sendFlow(param);
        }
    }


    //作废流程
    handleInvalid(){
        let t = this;
		var isPush = t.state.isPush;
		var db = DB;
		Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
			content: '是否要'+t.state.finalButtons.get("BASE_INVALID")+'审批？',
			onConfirm() {
				db.FlowModuleAPI.cancelProcess({
                    taskId: t.state.taskId,
                    processInstanceId:t.state.processInstanceId,
                    module:t.state.module,
                    permissionCode:t.state.permissionCode
				}).then((content) => {
					Toast.show({
						type: 'success',
						content: t.state.finalButtons.get("BASE_INVALID")+'成功',
                    });
                    //操作回调
                    if(typeof FlowCommon.operateCallBack === "function"){
                        let dataId = t.state.dataId;
                        FlowCommon.operateCallBack({type:2,dataId:dataId,isBatch:0},t.state);
                    }
					if (isPush == '0') {
                        setTimeout(
							function () {
								history.back();
							}, 1500);
					} else {
						backPage();
					}

				}).catch((error) => {
					setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: error.errorMsg,
                            });
                        }, 800);
				});
			},
			onCancel() {
			  console.log('confirm cancel');
			},
		  });
    }

	

     //转办流程
	transferClick(){
		let t = this;
		var isPush = t.state.isPush;
        var db = DB;
        var transferPersonValue =  t.state.transferPersonValue;
        var assignId = "";
        var assignName = "";
        transferPersonValue.map((item, index) => {
            assignId  += (item.scopeValue + ',');
            assignName +=(item.scopeName+',');
        });
        if(assignId == ''){
            Toast.show({
                type: 'error',
                content: '请选择转交人',
            });
            return false;
        }else{
            assignId = assignId.substring(0,assignId.length-1);
            assignName = assignName.substring(0,assignName.length-1);
        }
        var shortMessage='0';
        var transferShortMessage = t.state.transferShortMessage;
        if(transferShortMessage.length>0){
        	shortMessage=transferShortMessage[0].value;
        }
		Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
			content: '是否要'+t.state.finalButtons.get("BASE_TRANSFER")+'审批？',
			onConfirm() {
               
                db.FlowModuleAPI.transferFlow({
                    formId:t.state.formId,
                    dataId: t.state.dataId,
                    taskId: t.state.taskId,
                    processInstanceId:t.state.processInstanceId,
                    assignId: assignId,
                    assignName:assignName,
                    hasCommentField:'0',
                    module:t.state.module,
                    permissionCode:t.state.permissionCode,
                    participantMode:t.state.participantMode,
                    shortMessage:shortMessage
                }).then((content) => {
                    Toast.show({
                        type: 'success',
                        content: t.state.finalButtons.get("BASE_TRANSFER")+'成功',
                    });
                    if (isPush == '1') {
                        backPage();
                    } else {
                        setTimeout(
                            function () {
                                history.back();
                            }, 1500);
                    }
        
                }).catch((error) => {
                    if(typeof(error.errorMsg) == 'undefined'){
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: '提交出错',
                                });
                            }, 800);
                    }else{
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: error.errorMsg,
                                });
                            }, 800);
                    }
                });
			},
			onCancel() {
			  console.log('confirm cancel');
			},
		  });
		
    }
    
	addlots(){
		let t = this;
        var db = DB;
        var addlotsPersonValue =  t.state.addlotsPersonValue;
        var assignId = "";
        var assignName = "";
        addlotsPersonValue.map((item, index) => {
            assignId  += (item.scopeValue + ',');
            assignName +=(item.scopeName+',');
        });
        if(assignId == ''){
            Toast.show({
                type: 'error',
                content: '请选择加签人',
            });
            return false;
        }else{
            assignId = assignId.substring(0,assignId.length-1);
            assignName = assignName.substring(0,assignName.length-1);
        }
        var shortMessage='0';
        var addlotsShortMessage = t.state.addlotsShortMessage;
        if(addlotsShortMessage.length>0){
        	shortMessage=addlotsShortMessage[0].value;
        }
		Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
			content: '是否要'+t.state.finalButtons.get("HELP_ADDLOTS")+'审批？',
			onConfirm() {
                db.FlowModuleAPI.addSign({
                	 dataId: t.state.dataId,
                     taskId: t.state.taskId,
                     assignees: assignId,
                     assigneeNames: assignName,
                     participantMode:t.state.participantMode,
                     module:t.state.module,
                     permissionCode:t.state.permissionCode,
                     formId:t.state.formId,
                     processInstanceId:t.state.processInstanceId,
                    shortMessage:shortMessage
                }).then((content) => {
                    Toast.show({
                        type: 'success',
                        content: t.state.finalButtons.get("HELP_ADDLOTS")+'成功',
                    });
                 
                        setTimeout(
                            function () {
                                history.back();
                            }, 1500);
                    
        
                }).catch((error) => {
                    if(typeof(error.errorMsg) == 'undefined'){
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: '提交出错',
                                });
                            }, 800);
                    }else{
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: error.errorMsg.replace('!','').replace('！',''),
                                });
                            }, 800);
                    }
                });
			},
			onCancel() {
			  console.log('confirm cancel');
			},
		  });
		
    }
	
	circulateNode(){
		let t = this;
		var db = DB;
		var value =  t.state.circulateNodePersonValue;
		var targetUserIds = '';
        var targetUserNames = '';
        var orgIds = "";
        for(var i=0; i<value.length; i++){
            if(value[i].scopeType=='org'){
                orgIds  += (value[i].scopeValue + ',');
            }else if(value[i].scopeType=='user'){
                targetUserIds  += (value[i].scopeValue + ',');
                targetUserNames +=(value[i].scopeName+',');
            }
        }
        if(orgIds != ''){
            orgIds = orgIds.substring(0,orgIds.length-1);
            var orgUserList = getUsersByOrgIDs(orgIds);
            var orgUserids = ''; 
            var orgUsernames = '';
            for(var j=0; j<orgUserList.length; j++){
                if(targetUserIds.indexOf(orgUserList[j].id)<0){
                    orgUserids += orgUserList[j].id+",";
                    orgUsernames += orgUserList[j].userName+",";
                }
            }
            targetUserIds += orgUserids;
            targetUserNames += orgUsernames;
        }
        if(targetUserIds){
            targetUserIds = targetUserIds.substring(0,targetUserIds.length-1);
            targetUserNames = targetUserNames.substring(0,targetUserNames.length-1);
        }

        if(targetUserIds == ''){
            Toast.show({
                type: 'error',
                content: '请选择传阅人',
            });
            return false;
        }
        var shortMessage='0';
        var circulateShortMessage = t.state.circulateShortMessage;
        if(circulateShortMessage.length>0){
        	shortMessage=circulateShortMessage[0].value;
        }
		Dialog.confirm({
			locale: 'zh_CN',
			title: '提示',
			content: '是否要'+t.state.finalButtons.get("HELP_CIRCULATE")+'审批？',
			onConfirm() {
				db.FlowModuleAPI.createReadTask({
					dataId: t.state.dataId,
	                 taskId: t.state.taskId,
	                 targetUserIds: targetUserIds,
	                 targetUserNames:targetUserNames,
	                 module:t.state.module,
	                 formId:t.state.formId,
	                 permissionCode:t.state.permissionCode,
	                 processInstanceId:t.state.processInstanceId,
					shortMessage:shortMessage
				}).then((content) => {
					Toast.show({
						type: 'success',
						content: t.state.finalButtons.get("HELP_CIRCULATE")+'成功',
					});
					
						setTimeout(
								function () {
									history.back();
								}, 1500);
					
					
				}).catch((error) => {
					if(typeof(error.errorMsg) == 'undefined'){
						setTimeout(
								function () {
									Toast.show({
										type: 'error',
										content: '提交出错',
									});
								}, 800);
					}else{
						setTimeout(
								function () {
									Toast.show({
										type: 'error',
										content: error.errorMsg,
									});
								}, 800);
					}
				});
			},
			onCancel() {
				console.log('confirm cancel');
			},
		});
		
	}
	
     //跳转流程
     jump(){
		let t = this;
		var isPush = t.state.isPush;
        var db = DB;
        var jumpPersonValue =  t.state.jumpPersonValue;
        var assignId = "";
        var assignName = "";
        //判断是否选了节点
        var selectJumpActivity = this.state.selectJumpActivity;
        if(!selectJumpActivity.value){
            Toast.show({
                type: 'error',
                content: '请选择跳转节点',
            });
            return false;
        }
        // 判断是否选择人
        jumpPersonValue.map((item, index) => {
            assignId += item.scopeValue+","; 
            assignName += item.scopeName+",";
        });

        if(assignId == ''){
            Toast.show({
                type: 'error',
                content: '请选择跳转人',
            });
            return false;
        }else{
            assignId = assignId.substring(0,assignId.length-1);
            assignName = assignName.substring(0,assignName.length-1);
        }
        var selectedActivity = '[{"id":"'+selectJumpActivity.value+'","name":"'+selectJumpActivity.content+'","participants":"'+assignId+'","participantNames":"'+assignName+'"}]';
        var shortMessage='0';
        var jumpShortMessage = t.state.jumpShortMessage;
        if(jumpShortMessage.length>0){
        	shortMessage=jumpShortMessage[0].value;
        }
        var editFormData = this.state.editFormData;
        let mtd = editFormData.mainTblData;
        for(let i = 0; i < mtd.length; i++){//这三个值不用记录日志，所以把值清空
            let item = mtd[i];
            if(item.key == 'interval_date' || item.key == 'repetitive_week' || item.key == 'repetitive_month'){
                mtd.splice(i, 1);
                i--;
            }
        }
        Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
			content: '是否要'+t.state.finalButtons.get("BASE_JUMP")+'审批？',
			onConfirm() {
                db.FlowModuleAPI.jump({
                    formId:t.state.formId,
                    dataId: t.state.dataId,
                    taskId: t.state.taskId,
                    processInstanceId: t.state.processInstanceId,
                    selectedActivity:selectedActivity,
                    auditorUserIds: assignId,
                    allEditIds:t.getAllEditIds(t.state.editFormData),
                    formData: JSON.stringify(editFormData),
                    hasCommentField:'0',
                    editType:t.state.editType,
                    module:t.state.module,
                    permissionCode:t.state.permissionCode,
                    shortMessage:shortMessage
                }).then((content) => {
                    Toast.show({
                        type: 'success',
                        content: t.state.finalButtons.get("BASE_JUMP")+'成功',
                    });
                    if (isPush == '1') {
                        backPage();
                    } else {
                        setTimeout(
                            function () {
                                history.back();
                            }, 1500);
                    }
        
                }).catch((error) => {
                    if(typeof(error.errorMsg) == 'undefined'){
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: '提交出错',
                                });
                            }, 800);
                    }else{
                        setTimeout(
                            function () {
                                Toast.show({
                                    type: 'error',
                                    content: error.errorMsg,
                                });
                            }, 800);
                    }
                });
			},
			onCancel() {
			  console.log('confirm cancel');
			},
		  });
	}
     
    //催办流程
     urgeFlow(){
		let t = this;
		var isPush = t.state.isPush;
        var db = DB;
        var selectUrgeActivity =  t.state.selectUrgeActivity;
        var urgeContent =  t.state.urgeContent;
        if(selectUrgeActivity==null || selectUrgeActivity.length<1){
            Toast.show({
                type: 'error',
                content: '请选择催办用户',
            });
            return false;
        }
     

        if(urgeContent == ''){
            Toast.show({
                type: 'error',
                content: '请输入催办内容',
            });
            return false;
        }
        var taskUserIds='';
        for(var s=0;s<selectUrgeActivity.length;s++){
        	if(s==0){
        		taskUserIds=selectUrgeActivity[s].value;
        	}else{
        		taskUserIds=taskUserIds+","+selectUrgeActivity[s].value;
        	}
        }
        var reminders='';
        var remindersList=t.state.reminders;
        for(var s=0;s<remindersList.length;s++){
        	if(s==0){
        		reminders=remindersList[s].value;
        	}else{
        		reminders=reminders+","+remindersList[s].value;
        	}
        }
        Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
			content: '是否要'+t.state.finalButtons.get("PAGE_URGE")+'流程？',
			onConfirm() {
            db.FlowModuleAPI.urgeFlow({
            	taskUserIds: taskUserIds,
                module:t.state.module,
                urgeContent:urgeContent,
                processInstanceId:t.state.processInstanceId,
                permissionCode:t.state.permissionCode,
                urgeTitle:t.state.fileTitle+"等待您的办理",
                reminders:reminders,
            }).then((content) => {
                Toast.show({
                    type: 'success',
                    content: t.state.finalButtons.get("PAGE_URGE")+'成功',
                });
                if (isPush == '1') {
                    backPage();
                } else {
                    setTimeout(
                        function () {
                            history.back();
                        }, 1500);
                }
    
            }).catch((error) => {
                if(typeof(error.errorMsg) == 'undefined'){
                    setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: '催办出错',
                            });
                        }, 800);
                }else{
                    setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: error.errorMsg,
                            });
                        }, 800);
                }
            });
			},
			onCancel() {
			  console.log('confirm cancel');
			},
		  });
		
	}

    getListButtonsByCodes(buttonCodes,dataId,isStart){
    	 buttonCodes=buttonCodes.replace('OTHER_RELATION','');
    	 if(buttonCodes==null || buttonCodes==''){
    		 var sysWatermark=this.state.sysWatermark;
          		if(null!=sysWatermark && sysWatermark!=''){
          			$('#sysWatermarkName').val(sysWatermark);
          			showWaterMarker('approveWaterMarker',sysWatermark);
         		}else{
         			$('#sysWatermarkName').val('');
         		}
         	
    	 }else{
    	 DB.FlowModuleAPI.getListButtonsByCodes({
    		 buttonCodes: buttonCodes
         }).then((content) => {
            var new_content =[];
            if(content.length>0){
                for(var c=0; c<content.length; c++){
                    var buttonCode = content[c]['buttonCode']; 
                    var buttonName = content[c]['buttonName'];
                    //alert(buttonCode+'_'+buttonName);
                    if(buttonCode=='PAGE_FEEDBACK' || buttonCode=='HELP_FORWARD' || buttonCode=='RECORD' || buttonCode=='BASE_JUMP'){
                        //不支持反馈、转发、代录、跳转
                    }else{
                        new_content.push(content[c]);
                    }
                }
            }
        	 this.setState({
        		 buttonCodeList:new_content
             });
        	 var buttonCodeList=new_content;
        	 var actionSheetButtonOpt = [];
        	 var actionSheetButtonOptName = [];
             var buttonIsMore = false;
             var buttonList = [];
             var sysWatermark=this.state.sysWatermark;
            /* buttonCodeList.push({'buttonCode':'BASE_SUMBIT','buttonName':'通过'});
             buttonCodeList.push({'buttonCode':'PAGE_SAVE','buttonName':'保存'});*/
        	 if(buttonCodeList.length>4){
                 for(var c=0; c<buttonCodeList.length; c++){
                     var buttonCode = buttonCodeList[c]['buttonCode'];
                     var buttonName = buttonCodeList[c]['buttonName'];
                     if(c<3){
                         if(buttonCode=='BASE_SUMBIT'){
                         	var sumbmitName = buttonName;
                             if(dataId == '' || isStart== true){
                                 sumbmitName = '提交';
                             }
                             buttonList.push({name:sumbmitName,type:'primary',display:'banner',no:1});
                         }else if(buttonCode=='PAGE_SAVE'){
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:13});
                         }else if(buttonCode=='BACK'){
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:2});
                         }else if(buttonCode=='BASE_TRANSFER'){
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:3});
                         }else if(buttonCode=='HELP_CIRCULATE'){
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:4});
                         }else if(buttonCode=='BASE_JUMP'){
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:5});
                         }else if(buttonCode=='HELP_ADDLOTS'){
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:6});
                         }else if(buttonCode=='BASE_END'){
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:8});
                         }else if(buttonCode=='BASE_INVALID'){
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:9});
                         }else if(buttonCode=='HELP_DISTRIBUTE'){
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:'distributeFlow'});
                         }else{
                             buttonList.push({name:buttonName,type:'secondary',display:'banner',no:buttonCode});
                         }
                     }else if(c==3){
                         buttonList.push({name:'更多',type:'secondary',display:'banner',no:-1});
                         actionSheetButtonOpt.push(buttonCode);
                         actionSheetButtonOptName.push(buttonName);
                     }else if(c>3){
                     	actionSheetButtonOpt.push(buttonCode);
                     	actionSheetButtonOptName.push(buttonName);
                     }
                 }
                 buttonIsMore = true;
             }else{
                 for(var c=0; c<buttonCodeList.length; c++){
                 	var buttonCode = buttonCodeList[c]['buttonCode'];
                     var buttonName = buttonCodeList[c]['buttonName'];
                     if(buttonCode=='BASE_SUMBIT'){
                     	var sumbmitName =buttonName;
                         if(dataId == '' || isStart== true){
                             sumbmitName = '提交';
                         }
                         buttonList.push({name:sumbmitName,type:'primary',display:'banner',no:1});
                     }else if(buttonCode=='PAGE_SAVE'){
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:13});
                     }else if(buttonCode.indexOf('BACK')>=0){
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:2});
                     }else if(buttonCode=='BASE_TRANSFER'){
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:3});
                     }else if(buttonCode=='HELP_CIRCULATE'){
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:4});
                     }else if(buttonCode=='BASE_JUMP'){
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:5});
                     }else if(buttonCode=='HELP_ADDLOTS'){
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:6});
                     }else if(buttonCode=='BASE_END'){
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:8});
                     }else if(buttonCode=='BASE_INVALID'){
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:9});
                     }else if(buttonCode=='HELP_DISTRIBUTE'){
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:'distributeFlow'});
                     }else{
                         buttonList.push({name:buttonName,type:'secondary',display:'banner',no:buttonCode});
                     }
                 }
             }
        	 this.setState({
         		buttonList:buttonList,
         		actionSheetButtonOpt:actionSheetButtonOpt,
         		actionSheetButtonOptName:actionSheetButtonOptName,
         		buttonIsMore:buttonIsMore
         	},function(){
         		if(null!=sysWatermark && sysWatermark!=''){
         			$('#sysWatermarkName').val(sysWatermark);
         			showWaterMarker('approveWaterMarker',sysWatermark);
        		}else{
        			$('#sysWatermarkName').val('');
        		}
        	});
         }).catch((error) => {
             console.error(error);
         });
       }
    }
     
     
     
	//撤销流程
	recallClick(){
		let t = this;
		var isPush = t.state.isPush;
		var db = DB;
		Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
			content: '是否要'+t.state.finalButtons.get("FLOW_REVOKE")+'审批？',
			onConfirm() {
				db.FlowModuleAPI.recall({
                    taskId: t.state.taskId,
                    formId:t.state.formId,
                    dataId: t.state.dataId,
                    processInstanceId:t.state.processInstanceId,
                    listType:t.state.listType,
                    permissionCode:t.state.permissionCode,
                    module:t.state.module,
				}).then((content) => {
					Toast.show({
						type: 'success',
						content: t.state.finalButtons.get("FLOW_REVOKE")+'成功',
                    });
                    //操作回调
                    if(t.state.listType == '4' && typeof FlowCommon.operateCallBack === "function"){
                        let dataId = t.state.dataId;
                        FlowCommon.operateCallBack({type:3,dataId:dataId,isBatch:0},t.state);
                    }
					if (isPush == '1') {
						backPage();
					} else {
						setTimeout(
							function () {
								history.back();
							}, 1500);
					}

				}).catch((error) => {
					setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: error.errorMsg,
                            });
                        }, 800);
				});
			},
			onCancel() {
			  console.log('confirm cancel');
			},
		  });
	}


	//取消流程
	cancelClick(){
		let t = this;
		var isPush = t.state.isPush;
		var db = DB;
		Dialog.confirm({
            locale: 'zh_CN',
            title: '提示',
			content: '是否要'+t.state.finalButtons.get("FLOW_CANCEL")+'审批？',
			onConfirm() {
				db.FlowModuleAPI.suspendProcess({
					processInstanceId: t.state.processInstanceId,
					module:t.state.module,
					permissionCode:t.state.permissionCode
				}).then((content) => {
					Toast.show({
						type: 'success',
						content: t.state.finalButtons.get("FLOW_CANCEL")+'成功',
                    });
                    //操作回调
                    if(typeof FlowCommon.operateCallBack === "function"){
                        let dataId = t.state.dataId;
                        FlowCommon.operateCallBack({type:2,dataId:dataId,isBatch:0},t.state);
                    }
					if (isPush == '1') {
						backPage();
					} else {
						setTimeout(
							function () {
								history.back();
							}, 1500);
					}

				}).catch((error) => {
					setTimeout(
                        function () {
                            Toast.show({
                                type: 'error',
                                content: error.errorMsg,
                            });
                        }, 800);
				});
			},
			onCancel() {
			  console.log('confirm cancel');
			},
		  });
	}


    //选择提交审批用户
    getPersion(i,newValue){
        var nextActivityList = this.state.nextActivityList;
        // for(var i=0; i<newValue.length; i++){
        //     form.personValue.push(newValue[i]);
        // }
        nextActivityList[i].personValue = newValue;
        this.setState({
            nextActivityList
        });
    }

    //选择用户时
    getChoosePerson(i,personValue,allPerson){
        var nextActivityList = this.state.nextActivityList;
        nextActivityList[i].personValue = personValue;
        //nextActivityList[i].allPerson = allPerson;
        this.setState({
            nextActivityList
        });
    }

    //选择随机用户时
    getRadomChoosePerson(j,i,personValue,allPerson){
        var nextRadomList = this.state.nextRadomList;
        var subRandomList = nextRadomList[j].subRandomList;
        subRandomList[i].personValue = personValue;
        nextRadomList[j].subRandomList = subRandomList;
        //nextActivityList[i].allPerson = allPerson;
        this.setState({
            nextRadomList
        });
    }

    //选择转交用户
    getTransferPersion(newValue){
        this.setState({
            transferPersonValue:newValue
        });
    }

    //选择传阅用户
    getCirculatePerson(newValue){
        this.setState({
            circulatePersonValue:newValue
        });
    }
    

     //选择跳转用户
     getJumpPersion(newValue){
        this.setState({
            jumpPersonValue:newValue
        });
    }

    //选择回退节点
    selectBackAct(value,index, data){
        this.setState({
            selectBackActivity:data[index]
        });
    }

    
    //选择跳转节点
    selectJumpAct(value,index, data){
        this.setState({
            selectJumpActivity:data[index]
        },function(){
            this.refs.jumpUserSelect.dialogClearItem(0);
        });
    }
    
    //选择催办用户
    selectUrgeAct(data){
    	this.setState({
    		selectUrgeActivity:data
    	});
    }
    selectReminders(data){
    	this.setState({
    		reminders:data
    	});
    }

    //选择驳回类型
    selectBackType(data){
        this.setState({
            backTypeSelectList:data
        });
    }

    //修改审批意见
    changeSpyj(newValue) {
    	let regRule= /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g;
    	if(newValue.match(regRule)){
    		Toast.show({
                type: 'error',
                content: '不能输入表情',
            });
    		return false;
    	}
    	if(newValue.length>200){
    		newValue=newValue.substring(0,200);
    	}
        this.setState({
            spyj: newValue,
        });
    }
    
    //修改催办内容
    changeUrgeContent(newValue) {
    	let regRule= /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g;
    	if(newValue.match(regRule)){
    		Toast.show({
    			type: 'error',
    			content: '不能输入表情',
    		});
    		return false;
    	}
    	if(newValue.length>200){
    		newValue=newValue.substring(0,200);
    	}
    	this.setState({
    		urgeContent: newValue,
    	});
    }
    
    changeBackReasonText(newValue) {
    	let regRule= /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g;
    	if(newValue.match(regRule)){
    		Toast.show({
    			type: 'error',
    			content: '不能输入表情',
    		});
    		return false;
    	}
    	if(newValue.length>200){
    		newValue=newValue.substring(0,200);
    	}
    	this.setState({
    		backReasonText: newValue,
    	});
    }
    
    changeRecoverReasonText(newValue) {
    	let regRule= /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g;
    	if(newValue.match(regRule)){
    		Toast.show({
    			type: 'error',
    			content: '不能输入表情',
    		});
    		return false;
    	}
    	if(newValue.length>200){
    		newValue=newValue.substring(0,200);
    	}
    	this.setState({
    		recoverReasonText: newValue,
    	});
    }

      /**
     * 取消操作
     **/
    handleCancelClick() {
        // 清空填写的数据
        // 返回上层页面
        let nextRadomList = this.state.nextRadomList;
        let nextActivityList = this.state.nextActivityList;
        for(var i=0;i<nextActivityList.length; i++){
            if(nextActivityList[i].personValue.length>0){
                this.refs[nextActivityList[i].value+"_"+i].dialogClearItem();
            }
        }
        for(var i=0;i<nextRadomList.length; i++){
            var nextRadomListItem = nextRadomList[i].subRandomList;
            for(var j=0;j<nextRadomListItem.length; j++){
                if(nextRadomListItem[j].personValue.length>0 || nextRadomListItem[j].commonUsedData.length>0){
                    this.refs[nextRadomListItem[j].value+"_"+j].dialogClearItem();
                }
            }
        }
        this.setState({
            spyj: '',
            pageStatus: '0',
            operate: 0,
            nextActivityList:[],//下一个活动节点列表
            nextRadomList:[],//下一个随机节点
            urgentSelectList:[],//紧急选项
            circulatePersonValue:[],//清空传阅人
            urgentList:[
                {
                value:"1",
                checked:false,
                content:'紧急',
                disable:false
                }
            ],//恢复初始状态
            savePhraseList:[
                {
                value:"1",
                checked:false,
                content:'是否保存为常用语',
                disable:false
                }
            ],
            savePhrase:[]
        },function(){
            $(window).scrollTop(0);
        });

    }

    //切换表单
    handleChange(obj) {
        var t = this;
        this.setState({activeItemIndex: obj.active});
        if(obj.active=='2'){
        	t.refs.flowChart_list.componentDidMount();
        }else if(obj.active=='3'){
        	t.refs.relationProcess_list.componentDidMount();
        }
    }

     //选择节点
    handleChecked(n,i,item,type,e){
        var checked = item.checked;
        var disable = item.disable;
        var isRadio = item.isRadio;
        if(item.end && !checked){
        	this.setState({
        		urgentHidden:true
            });
        }else{
        	this.setState({
        		urgentHidden:false
            });
        }
        var maxOutgoing = item.maxOutgoing;//1代表是排他单选，0代表多选
        var value = item.value;
        var mustHas = item.mustHas?item.mustHas:false;//某个活动节点至少选一个
        if(!disable){//只有可选时才改变状态
            let nextActivityList = [];
            if(type == 'next'){
                nextActivityList = this.state.nextActivityList;
            }else{
                nextActivityList = this.state.nextRadomList[n].subRandomList;
            }
            if(isRadio){//单选
                if(!checked){//选中的时候
                    for (var j=0; j<nextActivityList.length; j++) {
                        if(nextActivityList[j].disable == true){
                            return false;
                        }
                        if(nextActivityList[j].isRadio){
                            if(type == 'radom'){
                                if( maxOutgoing == 1 || value == nextActivityList[j].value ){
                                    nextActivityList[j].checked=false;
                                }
                            }else{
                                nextActivityList[j].checked=false;
                            }
                        }
                    }
                    nextActivityList[i].checked = !checked;
                    if(checked==false && item.end == false){//当选中时
                       // this.refs[item.value+"_"+i].clickAdd();
                    }
                }else{//取消选中的时候
                    if(item.must == true || mustHas == true){
                        return false;
                    }else{
                        nextActivityList[i].checked = !checked;
                    }
                }
            }else{
                if(!checked){//选中的时候
                    // if(item.must == true){
                    //     return false;
                    // }else{
                        nextActivityList[i].checked = !checked;
                        if(checked==false && item.end == false){//当选中时
                       // this.refs[item.value+"_"+i].clickAdd();
                        }
                   // }
                }else{
                    if(mustHas == true){//当必须有的时候
                       var no = 0;
                       for(var m=0;m<nextActivityList.length;m++){
                           if(m != i && nextActivityList[m].value==value && nextActivityList[m].checked==true){
                             no++;
                           }
                       }
                       if(no>0){//有其他的选中值时就会取消
                          nextActivityList[i].checked = !checked;
                       }
                    }else{
                        if(item.must == true){
                            return false;
                        }
                        nextActivityList[i].checked = !checked;
                    }
                }
            }


            if(maxOutgoing == '1'){//只有是随机和后继是单选的时候才可以取消另外一个选择
                if(type == 'next'){//选的是后继节点
                    var nextRadomListMain = this.state.nextRadomList;
                    nextRadomListMain.map(function(item1){
                        var nextRadomListItem = item1.subRandomList;
                        nextRadomListItem.map(function(item2){
                            item2.checked = false;
                        });
                    });
                   
                    this.setState({
                        nextActivityList:nextActivityList,
                        nextRadomList:nextRadomListMain,
                        //nextSelectType:type
                    })
                }else{//选的是随机节点
                    var nextActivity = this.state.nextActivityList;
                    var nextRadomListMain = this.state.nextRadomList;
                    if(!checked){
                        nextActivity.map(function(item){
                            item.checked = false;
                        });

                        nextRadomListMain.map(function(item1,f){
                            if(f != n){
                                var nextRadomListItem = item1.subRandomList;
                                nextRadomListItem.map(function(item2){
                                    item2.checked = false;
                                });
                            }else{
                                item1.subRandomList = nextActivityList;
                            }
                        });
                    }
                    this.setState({
                        nextActivityList:nextActivity,
                        nextRadomList:nextRadomListMain,
                        //nextSelectType:type
                    });
                }
                
            }else{
                if(type == 'next'){//选的是后继节点
                    this.setState({
                        nextActivityList:nextActivityList,
                        //nextSelectType:type
                    });
                }else{//选的是随机节点
                    var nextRadomListMain = this.state.nextRadomList;
                    nextRadomListMain[n].subRandomList = nextActivityList;
                    this.setState({
                        nextRadomList:nextRadomListMain,
                        //nextSelectType:type
                    });
                } 
            }
            
            
        }
     }

     //切换节点内容显示
     handleShow(j,i,arrow,show,type,e){
        let t = this;
        if(type == 'next'){//下一个后继活动
            var nextActivityList = this.state.nextActivityList;
            nextActivityList[i].arrow = !arrow;
            nextActivityList[i].show = !show;
             t.setState({
                nextActivityList:nextActivityList,
           });
        }else if(type == 'radom'){//下一个随机活动
            var nextRadomList = this.state.nextRadomList;
            var subRandomList = nextRadomList[j].subRandomList;
            subRandomList[i].arrow = !arrow;
            subRandomList[i].show = !show;
            nextRadomList[j].subRandomList = subRandomList;
             t.setState({
                nextRadomList:nextRadomList,
           });
        }
        
      
     }

     //加签回调
     addSignCallback(value){
    	 this.setState({
    		 addlotsPersonValue:value
     	});
     }

     //传阅回调
     circulateCallback(value){
    	 this.setState({
    		 circulateNodePersonValue:value
     	});
      }

     //选择紧急状态
    selectUrgent(data){
        this.setState({
            urgentSelectList:data
        });
    }
    
    changeTransferShortMessage(data){
    	this.setState({
    		transferShortMessage:data
    	});
    }
    changeSendShortMessage(data){
    	this.setState({
    		sendShortMessage:data
    	});
    }
    changeJumpShortMessage(data){
    	this.setState({
    		jumpShortMessage:data
    	});
    }
    changeBackShortMessage(data){
    	this.setState({
    		backShortMessage:data
    	});
    }
    changeCirculateShortMessage(data){
    	this.setState({
    		circulateShortMessage:data
    	});
    }
    changeAddlotsShortMessage(data){
    	this.setState({
    		addlotsShortMessage:data
    	});
    }

    //选择是否保存常用语
    selectSavePhrase(data){
        this.setState({
            savePhrase:data
        });
    }

    //选择常用语
    selectCommonwords(){
        let t = this;
        let phraseListNow = t.state.phraseList;
        if(phraseListNow.length>0){
            t.refs.slotCommonwords.show();
        }else{
            //获取常用语列表
            DB.FlowModuleAPI.getPersonalPhrase({
            }).then((content) => {
                if(content.length>0){
                    var phraseList1 = [];
                    content.map(function(item){
                        phraseList1.push({text:item.content,value:item.content});
                    });
                    var phraseList2 = [];
                    phraseList2.push(phraseList1);
                    t.setState({
                        phraseList:phraseList2,
                    },function(){
                        t.refs.slotCommonwords.show();
                    });
                }else{
                    Toast.show({
                        content: '暂无常用语',
                    });
                }
            }).catch((error) => {
                Toast.show({
                    type: 'error',
                    content: error.errorMsg,
                });
            });
        }
    }


    //切换修改常用语
    handleChangeCommonwords(value) {
        // 改变了选中项
        this.setState({
          choosePhrase:value,
        });
      }

    //确认选择语
    handleConfirmCommonwords(commonwords){
        let spyj = this.state.spyj;
        this.setState({
            spyj:spyj+commonwords[0].text
        });
    }
    
    componentWillReceiveProps(nextProps){
    	var listType = nextProps.params.listType;
        let permissionCode='other';
        let status = '0';
        let dataId = nextProps.params.dataId;
        let editType = '';
        if( dataId && dataId !='-1'){//非新增
            if(listType == '0'||listType == '5'){ //待办
                status = '1';
                editType = 'edit';
            }else{
                status = '2';
                editType = 'view';
            }
            
            if(listType == '0'){
            	permissionCode='pending';
            }else if(listType == '1'){
            	permissionCode='unRead';
            }else if(listType == '2'){
            	permissionCode='done';
            }else if(listType == '3'){
            	permissionCode='read';
            }else if(listType == '4'){
            	permissionCode='my';
            }else if(listType == '99'){
            	permissionCode='other';
            }
		}
		let isPush = nextProps.params.isPush;
        let isDraft = nextProps.params.isDraft;//是不是草稿箱,1是，0：不是
        if(isDraft){
        	permissionCode='draft';
        }else{
            isDraft = "0";
        }
        if(isPush!='0'){
        	permissionCode='other';
        }
        var activeItemIndex='0';
    	if(dataId!='-99'){
    		activeItemIndex='3';
        }
        //alert(listType);
        if(listType=='-99'){
    		activeItemIndex='0';
    	}
    	
    	this.setState({
            editType:editType,
            isPush: isPush,
            status: status,
            activeItemIndex: activeItemIndex,
            tableStatus: '0',
            permissionCode: permissionCode,
            listType:nextProps.params.listType,
            module:nextProps.params.module,
            processInstanceId:nextProps.params.processInstanceId,
            taskId:nextProps.params.taskId,
            dataId:nextProps.params.dataId,
            formId:nextProps.params.formId
        },function(){
            this.componentDidMount();
            if(activeItemIndex=='3'){
            	this.refs.relationProcess_list.componentDidMount();
            }
        });
    }

    render() {
        const isReadOnly = false;
        const t = this;
        return (
       
            <div className='t-PB68'>
	            <div className={this.state.errorMsg=='任务不存在'?"dd-state-page":'t-DN'}>
	            <div className="dd-state-box">
	              <VBox hAlign="center">
	                <Box>
	                  <div>
	                    <img src={msgNoData} alt="" />
	                  </div>
	                </Box>
	                <Box className="t-FS14 t-MT30 t-FAC t-LH1_3 t-FCddfontblue-40">
	                  内容已删除
	                </Box>
	              </VBox>
	            </div>
	          </div>
                <div className={this.state.errorMsg=='任务不存在' || this.state.errorMsg==''?"t-DN":'page-add'}>
                    {/* <Group.List>
                        <UserInfo  userId={this.props.params.startUserId}/>
                    </Group.List> */}
                    <div className={this.state.pageStatus=='0'?'':'t-DN'}>
                            <Tab activeKey={this.state.activeItemIndex==null?'0':this.state.activeItemIndex} onChange={this.handleChange.bind(this)}>
                            
                            <Tab.Item key={'0'} title="表单信息">
                             <div id="approveWaterMarker" style={{top:0,minHeight:200,overflow:'hidden'}}>
                                <div className={this.state.activeItemIndex == 0 ? '' : 't-DN'}>
	                                <Group.List>
	                                {this.state.tableStatus=='0'?
	                                		"":
	                                	<Table  module={this.state.module} status={t.state.status} form={t.state.formItem} allForm={t.state.form} data={t.state.editFormData} commentFieldList={t.state.commentFieldList} commentDefaultList={t.state.commentDefaultList} fieldControll={t.state.fieldControll} onChange={this.change.bind(this)}/>
	                                }
	                                </Group.List>
                                </div>
                              </div>
                            </Tab.Item>
                            <Tab.Item key={'1'} title="流程图">
                            <Group.List>
                                <div className={this.state.activeItemIndex == 1 ? 't-BCf' : 't-DN'} >
                                    <HBox vAlign="center" className="t-PL16 t-PR16 t-PT10 t-PB10 t-BCf t-FS14">
                                    <Box className="t-BCd t-WH10 t-MR4 t-ML10"></Box>
                                    <Box>已完成</Box>
                                    <Box className="t-BCyellow t-WH10 t-MR4 t-ML10"></Box>
                                    <Box>正在审批</Box>
                                    <Box className="t-BCddblue t-WH10 t-MR4 t-ML10"></Box>
                                    <Box>未审批</Box>
                                    </HBox>
                                    <div style={{textAlign: 'center',overflowX:'scroll'}}>
                                    <img src={URLS.getFlowImage+t.state.processInstanceId+'&token='+getLoginUserInfo().token+'&random='+t.state.keyNum}/>
                                    </div>
                                </div>
                                </Group.List>
                            </Tab.Item>
                            <Tab.Item key={'2'} title="流程记录">
                            <Group.List>
                                <div className={this.state.activeItemIndex == 2 ? '' : 't-DN'}>
                                    <FlowChart ref={"flowChart_list"} taskId={this.state.taskId}  processInstanceId={this.state.processInstanceId} listType={this.state.listType} />
                                </div>
                                </Group.List>
                            </Tab.Item>
                            <Tab.Item key={'3'} title="关联流程">
                            <Group.List>
                                <div className={this.state.activeItemIndex == 3 ? '' : 't-DN'}>
                                    <RelationProcess ref={"relationProcess_list"} dataId={this.state.dataId} categoryCode={this.state.categoryCode} formId={this.state.formId} processInstanceId={this.state.processInstanceId} listType={this.state.listType} />
                                </div>
                                </Group.List>
                            </Tab.Item>
                        </Tab>
                    </div>
                </div>
                <div  className={this.state.pageStatus=='0' && this.state.loadSuccess ?"t-P0 t-bottom-fixed":'t-DN'}>
                {
                    this.state.buttonList.length>0 ?
                     <Button.Group >
                    {
                        this.state.buttonList.map(function(item,i){
                        return (
                            <Button type={item.type} display={item.display} onClick={t.handleSubmit.bind(t,item.no)}>{item.name}</Button>
                            )}.bind(this))
                    }
                </Button.Group>
                :''}
                
                </div>
                <Group.List className={this.state.hasCommentField == '1' && (this.state.operate == 1 ||this.state.operate == 10||this.state.operate == 11) ? '': 't-DN'}>
                    <div style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>{'批示意见'}</span><span className="t-FCddblue t-FR" onClick={this.selectCommonwords.bind(this)}>常用语</span></div>
                    <TextareaField
                        readOnly={false}
                        minRows={10} maxRows={13}
                        placeholder={'请输入批示意见'}
                        value={this.state.spyj}
                        onChange={this.changeSpyj.bind(this)}/>
                    <CheckboxField
                            className={this.state.hasCommentField == '1'?"":"t-DN"}
                            data={this.state.savePhraseList}
                            mode="list"
                            onChange={this.selectSavePhrase.bind(this)}
                            required={false}
                            />
                    <Slot
                        ref="slotCommonwords"
                        data={this.state.phraseList}
                        value={this.state.choosePhrase}
                        title="选择常用语"
                        onConfirm={this.handleConfirmCommonwords.bind(this)}
                        onChange={this.handleChangeCommonwords.bind(this)}
                        />        
                </Group.List>
                <Group.List className={this.state.pageStatus=='1' && this.state.operate == 1?'':'t-DN'}>
                        <div className={this.state.nextActivityList.length==0 && this.state.nextRadomList.length == 0?'t-DN':''} style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>审批环节</span></div>
                        
                        {/* 随机活动 */}
                        <HBox vAlign="center" className={this.state.nextRadomList.length==0?'t-DN':'t-BB1 t-PT8 t-PB8'}>
                            <Box className="t-LH24 t-FS14 t-PL18 t-FCa" flex={1}>随机活动</Box>
                        </HBox>
                        {
                        this.state.nextRadomList.map(function(item1,j){
                        return (
                            <div >
                                <div className={'t-BCf7 t-H10'}></div>
                                 <HBox vAlign="center" className={'t-BB1 t-PT8 t-PB8'}>
                                    <Box className="t-LH24 t-FS13 t-PL22 t-FCb" flex={1}>{item1.name}</Box>
                                </HBox>
                               {
                                item1.subRandomList.map(function(item,i){
                                return (
                                <div className={i>0?'t-BT1':''}>
                                    <HBox vAlign="center" className="t-BB1">
                                    <HBox flex={1} className="t-PL16 t-PT10 t-PB10"  onClick={this.handleChecked.bind(this,j,i,item,"radom")}>
                                        <Box id={i} className={item.checked == false?"t-checkbox-field-icon-list un-checked":item.disable?"t-checkbox-field-icon checked disable t-checkbox-field-icon-list":"t-checkbox-field-icon-list"}   >
                                        <i className="iconfont icon-checked t-FCf t-FS14"></i>
                                        </Box>
                                        <Box className="t-LH24 t-FS16 t-PL18 t-omit" flex={1}>{item.name}</Box>
                                    </HBox>
                                    <Box className={item.end?'t-DN':'t-PL16 t-PR16'} onClick={this.handleShow.bind(this,j,i,item.arrow,item.show,"radom")}>
                                        <i className={item.arrow?"iconfont icon-arrow-up t-FCc":"iconfont icon-arrow-down t-FCc"}></i>
                                    </Box>
                                    </HBox>
                                    <Box className={item.show?"":"t-DN"} >
                                        <SelectMember 
                                            required={false}
                                        isShowInMyOrg={true}
                                            readOnly={item.selectUserReadOnly}
                                            label={'审批人'}
                                            placeholder="请选择"
                                            code={item.code}
                                            chooseType={item.chooseType}
                                            checkType={item.participantMode=='0'?'radio':'checkbox'}
                                            ref={item.value+"_"+i}
                                            isDelete={true}
                                            defaultValue={item.personValue}
                                            commonUsedData={item.commonUsedData}
                                            onChange={this.getRadomChoosePerson.bind(this,j,i)}
                                        />
                                    </Box>
                                </div>
                                )}.bind(this))}
                            </div>
                        )}.bind(this))}

                        {/* 后继活动 */}
                        <HBox vAlign="center" className={this.state.nextActivityList.length==0?'t-DN':'t-BB1 t-PT8 t-PB8'}>
                            <Box className="t-LH24 t-FS14 t-PL16 t-FCa" flex={1}>后继活动</Box>
                        </HBox>
                        {
                        this.state.nextActivityList.map(function(item,i){
                        return (
                            <div className={i>0?'t-BT1':''}>
                                <HBox vAlign="center" className="t-BB1">
                                <HBox flex={1} className="t-PL16 t-PT10 t-PB10"  onClick={this.handleChecked.bind(this,i,i,item,"next")}>
                                    <Box id={i} className={item.checked == false?"t-checkbox-field-icon-list un-checked":item.disable?"t-checkbox-field-icon checked disable t-checkbox-field-icon-list":"t-checkbox-field-icon-list"}   >
                                    <i className="iconfont icon-checked t-FCf t-FS14"></i>
                                    </Box>
                                    <Box className="t-LH24 t-FS16 t-PL18 t-omit" flex={1}>{item.name}</Box>
                                </HBox>
                                <Box className={item.end?'t-DN':'t-PL16 t-PR16'} onClick={this.handleShow.bind(this,i,i,item.arrow,item.show,"next")}>
                                    <i className={item.arrow?"iconfont icon-arrow-up t-FCc":"iconfont icon-arrow-down t-FCc"}></i>
                                </Box>
                                </HBox>
                                <Box className={item.end==true||item.show==false?"t-DN":""} >
                                    <SelectMember 
                                        readOnly={item.selectUserReadOnly}
                                        label={'审批人'}
                                        placeholder="请选择"
                                        code={item.code}
                                        chooseType={item.chooseType}
                                        checkType={item.participantMode=='0'?'radio':'checkbox'}
                                        ref={item.value+"_"+i}
                                        isDelete={true}
                                        defaultValue={item.personValue}
                                        commonUsedData={item.commonUsedData}
                                        onChange={this.getChoosePerson.bind(this,i)}
                                    />
                                </Box>
                            </div>
                        )}.bind(this))}
                        
                  
                        <div className={this.state.buttons.indexOf("HELP_CIRCULATE")>-1 && this.state.isHideRead==false?"":"t-DN"} style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>传阅</span></div>
                        <div className={this.state.buttons.indexOf("HELP_CIRCULATE")>-1 && this.state.isHideRead==false?"":"t-DN"}>
                            <SelectMember 
                                required={false}
                                readOnly={false}
                            isShowInMyOrg={true}
                                label={'传阅人'}
                                placeholder="请选择"
                                code={'org'}
                                chooseType={'userAndOrg'}
                                checkType={'checkbox'}
                                isDelete={true}
                                defaultValue={this.state.circulatePersonValue}
                                onChange={this.getCirculatePerson.bind(this)}
                            />
                            <CheckboxField
                            data={this.state.readShortMessageList}
                            className={this.state.sysSMSsetting=='1'?"":"t-DN"}
                            mode="list"
                            onChange={this.changeCirculateShortMessage.bind(this)}
                            required={false}/>
                      </div>
                </Group.List>
                <Group.List className={this.state.pageStatus=='1' && this.state.operate == 3 ?'':'t-DN'}>
                <div style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>转交环节</span></div>
                     <SelectMember 
                        required={false}
                        readOnly={false}
                     isShowInMyOrg={true}
                        label={'转交人'}
                        placeholder="请选择"
                        code={'org'}
                        chooseType={'userNotOrg'}
                        checkType={this.state.participantMode=='0'?'radio':'checkbox'}
                        isDelete={true}
                        defaultValue={this.state.transferPersonValue}
                        onChange={this.getTransferPersion.bind(this)}/>
                     
                     <CheckboxField
                     data={this.state.shortMessageList}
                     className={this.state.sysSMSsetting=='1'?"":"t-DN"}
                     mode="list"
                     onChange={this.changeTransferShortMessage.bind(this)}
                     required={false}/>
                 </Group.List>
                {/* 待阅 */}
				<div className={ this.state.listType == 1 && this.state.readtype =="1" && this.state.loadSuccess  ? 't-P0 t-bottom-fixed' : 't-DN'}>
					<Button.Group >
						<Button type="primary" display="banner" onClick={t.clickRead.bind(t)}>已阅</Button>
					</Button.Group>
				</div>
                <div className={this.state.pageStatus=='1'?"page-add":'t-DN'}>
                 <Group.List className={this.state.operate == 2 && this.state.canBackActivity.length>0 ? '': 't-DN'}>
                 <div style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>退回环节</span></div>
                        <RadioField
                            data={this.state.canBackActivity}
                            mode="list"
                            onChange={this.selectBackAct.bind(this)}
                            required={true}
                            />
                           
                        <CheckboxField
                            className={ this.state.canBackType.indexOf('3')>=0  && this.state.participantMode== '0'?'':'t-DN'}
                            data={this.state.backTypeList}
                            mode="list"
                            label="退回类型"
                            onChange={this.selectBackType.bind(this)}
                            required={false}
                            />
                       
                        <TextareaField
                        readOnly={false}
                        label={'退回原因'}
                        required={true}
                        minRows={10} maxRows={13}
                        placeholder={'请输入退回原因'}
                        value={this.state.backReasonText}
                        onChange={this.changeBackReasonText.bind(this)}/> 
                        
                        <CheckboxField
                        data={this.state.shortMessageList}
                        className={this.state.sysSMSsetting=='1'?"":"t-DN"}
                        mode="list"
                        onChange={this.changeBackShortMessage.bind(this)}
                        required={false}/>
                        
                    </Group.List>
                    {/*跳转*/}
                    <Group.List className={this.state.operate == 5 && this.state.nextJumpActivity.length>0 ? '': 't-DN'}>
                    <div style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>跳转环节</span></div>
                        <RadioField
                            data={this.state.nextJumpActivity}
                            mode="list"
                            onChange={this.selectJumpAct.bind(this)}
                            required={true}
                            />
                        <SelectMember 
                            required={false}
                            readOnly={false}
                        isShowInMyOrg={true}
                            label={'跳转人'}
                            placeholder="请选择"
                            code={'org'}
                            chooseType={'userNotOrg'}
                            checkType={this.state.selectJumpActivity.participantMode=='0'?'radio':'checkbox'}
                            isDelete={true}
                            defaultValue={this.state.jumpPersonValue}
                            onChange={this.getJumpPersion.bind(this)}
                            ref="jumpUserSelect"
                        />
                    
                	 <CheckboxField
                     data={this.state.shortMessageList}
                        className={this.state.sysSMSsetting=='1'?"":"t-DN"}
                     mode="list"
                     onChange={this.changeJumpShortMessage.bind(this)}
                     required={false}/>
                                     	
                     </Group.List>
                        
                    {/*加签*/}
                    <Group.List className={this.state.operate == 6 ?'':'t-DN'}>
                    <div style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>加签</span></div>
		                    <SelectMember 
		                    required={false}
		                    readOnly={false}
		                    isShowInMyOrg={true}
		                    label={'加签人'}
		                    placeholder="请选择"
		                    code={'org'}
		                    chooseType={'userNotOrg'}
		                    checkType={'checkbox'}
		                    ref={"selectMember_addSign"}
		                    isDelete={true}
		                    onChange={this.addSignCallback.bind(this)}
		                />
                         
                         <CheckboxField
                         data={this.state.shortMessageList}
		                    className={this.state.sysSMSsetting=='1' && this.state.participantMode=='1'?"":"t-DN"}
                         mode="list"
                         onChange={this.changeAddlotsShortMessage.bind(this)}
                         required={false}/>
                     </Group.List>  
                        
                    {/*传阅*/}
                    <Group.List className={this.state.operate == 4 ?'':'t-DN'}>
                    <div style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>传阅</span></div>
				            <SelectMember 
				            required={false}
				            readOnly={false}
				            isShowInMyOrg={true}
				            label={'传阅人'}
				            placeholder="请选择"
				            code={'user,org'}
				            chooseType={'userAndOrg'}
				            checkType={'checkbox'}
				            ref={"selectMember_circulate"}
				            isDelete={true}
				            onChange={this.circulateCallback.bind(this)}
				        />
                         
                         <CheckboxField
                         data={this.state.readShortMessageList}
				            className={this.state.sysSMSsetting=='1'?"":"t-DN"}
                         mode="list"
                         onChange={this.changeCirculateShortMessage.bind(this)}
                         required={false}/>
                     </Group.List>    
                        
                        
                    {/*催办*/}
                    <Group.List className={this.state.operate == 12 && this.state.urgeDataList.length>0 ? '': 't-DN'}>
                    <div style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>催办环节</span></div>
                        <CheckboxField
                            data={this.state.urgeDataList}
                            mode="list"
                            onChange={this.selectUrgeAct.bind(this)}
                            required={true}
                            />
                        <TextField
                        readOnly={true}
                        label={'催办标题'}
                        required={true}
                        value={this.state.fileTitle+"等待您的办理"}/>  
                        		
                        <TextareaField
                        readOnly={false}
                        label={'催办内容'}
                        required={true}
                        minRows={10} maxRows={13}
                        placeholder={'请输入催办内容'}
                        value={this.state.urgeContent}
                        onChange={this.changeUrgeContent.bind(this)}/>  
                  
                        <CheckboxField
                        data={this.state.remindersList}
                        mode="list"
                        onChange={this.selectReminders.bind(this)}
                        required={true}
                        />
                        </Group.List>
                        {/*收回*/}
                        <Group.List className={this.state.operate == 14? '': 't-DN'}>
                        <div style={{background:'#f2f3f5',height:'35px',padding:'10px 5px'}}><span className="t-FCddblue"><i className="iconfont icon-back t-rotate-180 t-FS14 t-FR"></i>收回环节</span></div>
                               <TextareaField
                               readOnly={false}
                               label={'收回原因'}
                               required={true}
                               minRows={10} maxRows={13}
                               placeholder={'请输入收回原因'}
                               value={this.state.recoverReasonText}
                               onChange={this.changeRecoverReasonText.bind(this)}/>  
                            </Group.List>   
                        
                    <div  className="t-P0 t-bottom-fixed">
                    <Button.Group>
                        <Button type="primary" display="banner"
                                onClick={this.handleSubmitClick.bind(this)}>确认</Button>
                        <Button type="secondary" display="banner" onClick={this.handleCancelClick.bind(this)}>取消</Button>
                    </Button.Group>
                    </div>
                </div>
            </div>
        );
    }

}
export default PageHome;
